<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[uniplacesgeeks - Medium]]></title>
        <description><![CDATA[Stories, tips and overview about how we solve problems - Medium]]></description>
        <link>https://medium.com/uniplacesgeeks?source=rss----266849bf47b1---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>uniplacesgeeks - Medium</title>
            <link>https://medium.com/uniplacesgeeks?source=rss----266849bf47b1---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 15:36:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/uniplacesgeeks" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Docker disk usage analysis]]></title>
            <link>https://medium.com/uniplacesgeeks/docker-disk-usage-analysis-9cb9a617972f?source=rss----266849bf47b1---4</link>
            <guid isPermaLink="false">https://medium.com/p/9cb9a617972f</guid>
            <category><![CDATA[uniplaces]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[local-environment]]></category>
            <category><![CDATA[disk-usage]]></category>
            <dc:creator><![CDATA[Raffaello Pieri]]></dc:creator>
            <pubDate>Wed, 09 Jan 2019 10:21:34 GMT</pubDate>
            <atom:updated>2018-12-05T17:03:15.210Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<p>At <a href="https://www.uniplaces.com/">Uniplaces</a> we run our applications in Docker containers and we have a local environment used to test services against each other in the development stage.<br>Before dockerizing everything, our playground was based on a virtual machine with a significant amount of disk space was allocated to it. In most cases, it was hard, if not impossible, to reduce the disk and memory footprint.<br>By having the playground based on a network where we can attach containers to; each application can have its own docker-compose configuration that encapsulates how each container should be identified on the network.</p><h4>Before starting</h4><p>The first command is <a href="https://docs.docker.com/engine/reference/commandline/ps/">docker ps</a>and is used to list all the containers showing the status, the image used to build it and with the command was launched with:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa350584459a02ca0733d11088a59114/href">https://medium.com/media/fa350584459a02ca0733d11088a59114/href</a></iframe><p>docker ps is focused on the connectivity, showing what ports are exposed inside the network and how the container is exposed outside the network.</p><p>The second one is <a href="https://docs.docker.com/engine/reference/commandline/volume_ls/">docker volume ls</a>and is used to list the volumes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29ced2fac01ab0ba6be7f3bc28a8b105/href">https://medium.com/media/29ced2fac01ab0ba6be7f3bc28a8b105/href</a></iframe><p>The third one is docker volume lsand is used to list images:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c654a079cff053e21ae218b1e47a2dad/href">https://medium.com/media/c654a079cff053e21ae218b1e47a2dad/href</a></iframe><p>With these commands, we have enough information to see the images available in the docker env, which can be useful for us to start a new container.</p><h3>Disk usage analysis</h3><p>So let’s start digging the system, the goal is to maintain the disk of our machine clean while understanding what resources are been consumed. To start this journey let’s invoke the <a href="https://docs.docker.com/engine/reference/commandline/system_df/">docker system df</a> command:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27ad47b494a7580e62ba6e5640db5ffc/href">https://medium.com/media/27ad47b494a7580e62ba6e5640db5ffc/href</a></iframe><p>At the moment there are only images, seven in total, occupying almost 3GB and all of them are removable as there’s nothing referring to them.</p><p>To get some more details, such as what images, containers and volumes exist, the size and other specific metadata per docker resource, add the verbose flag:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b79072048db094fe285cc3b1c20c750/href">https://medium.com/media/3b79072048db094fe285cc3b1c20c750/href</a></iframe><p>Let’s start some services and see how things change.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cefdd4c9ac56bee6562921e57a31dde5/href">https://medium.com/media/cefdd4c9ac56bee6562921e57a31dde5/href</a></iframe><p>There are now five containers running with two volumes, none of this space is reclaimable while the reclaimable space for images went down to 38%.<br>Being more verbose:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8b7169ae61174b34dfefa882b100004/href">https://medium.com/media/f8b7169ae61174b34dfefa882b100004/href</a></iframe><h4>Working with volumes</h4><p>Two of the five running containers have an attached volume, to know what container is using a volume let’s run:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d5bd3b57d29e3b7d81bf716f65b1612/href">https://medium.com/media/9d5bd3b57d29e3b7d81bf716f65b1612/href</a></iframe><p>This volume is used by the <em>redis-dev</em> container.<br>Combining the two listing commands with some shell scripting is possible to list all the containers and their usage:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7899dfb15ae105166dcf0f29f447fe5/href">https://medium.com/media/f7899dfb15ae105166dcf0f29f447fe5/href</a></iframe><p>Here, for each volume is extracted the name that is then used in the filter query to select the containers which are using it.</p><p>Applying the dangling filter to<em> </em>the<em> </em>docker volume ls<em> </em>command the output will show only the unused volumes.</p><pre>docker volume ls -f dangling=true</pre><p>These are the images that would be deleted running docker volume prune</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/76b8cbe009c9df562178f94a98169a1c/href">https://medium.com/media/76b8cbe009c9df562178f94a98169a1c/href</a></iframe><h4>Working with containers</h4><p>When the goal is to clean up all the docker environment the first resources to be removed must be the containers as they lock all the rest (images, volumes, networks).</p><p>docker ps comes with a flag to list all the containers and combined with the quiet flag will output only ids of all the containers, running or not. It’s now easy to remove all the containers in one line:</p><pre>docker rm -f $(docker ps -q -a)</pre><h4>Working with images</h4><p>The listing <em>“system df with running containers verbose” </em>shows that the image <em>200cbd58d198</em> has not been used, let’s remove it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f4387eb722eba392a8ca07999974de8/href">https://medium.com/media/6f4387eb722eba392a8ca07999974de8/href</a></iframe><p>For the sake of example, let’s get the image back; an image can be pulled as</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69747e95bbef7c8d4e0fa4986b2b48f0/href">https://medium.com/media/69747e95bbef7c8d4e0fa4986b2b48f0/href</a></iframe><p>A docker image is made of layers, pulling an image means pulling the layers that compose the image itself and removing an image means removing the layers that’s why there are several lines when removing or pulling an image.</p><p>Sometimes, it can be useful to investigate how an image has been built, in other words, its <a href="https://docs.docker.com/engine/reference/commandline/history/">history</a>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e445cba7d3668fad1c25a35d9b8446de/href">https://medium.com/media/e445cba7d3668fad1c25a35d9b8446de/href</a></iframe><p>To better view the layers let’s combine the <em>no truncate</em> flag with the <em>format</em> option</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82b411bcf2f67131b65d135238dd54ba/href">https://medium.com/media/82b411bcf2f67131b65d135238dd54ba/href</a></iframe><p>It can be useful to list the images ordered by their size to be easier to evaluate what image is using more disk. Docker with some shell scripting to help can accomplish this by:</p><pre>docker image ls —-format ‘{{.Size}}\t{{.Repository}}:{{.Tag}}\t{{.ID}}’ | sort -hr | column -t</pre><p>Finally, with the same kind of command used to delete containers, images can be deleted with:</p><pre>docker rmi -f $(docker images -a -q)</pre><p>Besides the <em>force </em>flag, this command will not delete an image if it’s used by a container or if it has dependent child images.</p><h4>Prune the system</h4><p>After all is good to remember a powerful <a href="https://docs.docker.com/engine/reference/commandline/system_prune/">command</a> that deletes all the unused data:</p><pre>docker system prune</pre><p>This will also delete unused networks, a topic that wasn’t spoken in this article because docker networks don’t consume the disk space.</p><h4>Conclusions</h4><p>This set of commands is enough to maintain the system clean removing what is occupying the disk unnecessarily. Finally, to perform any kind of analysis docker commands have the <a href="https://docs.docker.com/engine/reference/commandline/inspect/">inspect</a> subcommand, that combined with the <a href="https://docs.docker.com/config/formatting/">format</a> option<em> </em>become a powerful tool for investigating any docker resource.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cb9a617972f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uniplacesgeeks/docker-disk-usage-analysis-9cb9a617972f">Docker disk usage analysis</a> was originally published in <a href="https://medium.com/uniplacesgeeks">uniplacesgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tips and tricks for AWS SSM Parameter Store with confd]]></title>
            <link>https://medium.com/uniplacesgeeks/tips-and-tricks-for-aws-ssm-parameter-store-with-confd-f0bf066005fd?source=rss----266849bf47b1---4</link>
            <guid isPermaLink="false">https://medium.com/p/f0bf066005fd</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[configuration-management]]></category>
            <dc:creator><![CDATA[János Krnák]]></dc:creator>
            <pubDate>Tue, 18 Dec 2018 17:39:07 GMT</pubDate>
            <atom:updated>2018-12-19T10:04:05.706Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lsbnXZ_1DnTxjLfDL-pteQ.png" /><figcaption>Container startup with confd</figcaption></figure><p>SSM parameter store is a service from AWS which allows you to manage configuration parameters for your applications, let that be the environment it runs in, passwords for database access, API tokens or whatever you need. It also gives server side encryption for values that should be kept secret and fine grain access control via IAM.</p><p>You can organise your parameters into hierarchies by using forward slash in the parameter names. For example you can choose the root element to reflect your environment (staging, prod etc), the second level for your application and then comes the parameter, it could look something like: /production/client-api/database/host. To learn more about this service, please read <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html">the documentation</a>.</p><p>For the rest of this post I’m assuming that you have AWS CLI set up on your machine, if not you can find detailed instructions on AWS’s <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html">documentation</a>. Also you will need <a href="https://stedolan.github.io/jq/download/">jq</a> and <a href="https://github.com/kelseyhightower/confd/releases">confd</a> for the more interesting sections.</p><h3>Using the AWS CLI to manage the parameters</h3><p>Just to have something to work with, we are going to create two parameters.</p><pre>$ aws ssm put-parameter --name /dev/client-api/database/user --value client --type String</pre><pre>$ aws ssm put-parameter --name /dev/client-api/database/password --value p@ssw0rd --type SecureString</pre><p>In both cases the output will tell us the version of the parameter. In this case as it was the first value for the parameters, the version will be 1.</p><pre>{<br>  &quot;Version&quot;: 1<br>}</pre><p>Parameters do change over time and to update a value you will need to add the --overwrite option to the command.</p><pre>$ aws ssm put-parameter --name /dev/client-api/database/password --value p@ssw0rd2 --type SecureString --overwrite<br>{<br>    &quot;Version&quot;: 2<br>}</pre><h4>Querying parameters</h4><p>We can now query the just created parameters. I’m going to use jq to filter the response a bit for the sake of brevity.</p><pre>$ aws ssm get-parameters-by-path --recursive --path /dev/client-api | jq &#39;.Parameters | map({Name,Value,Version})&#39;<br>[<br>  {<br>    &quot;Name&quot;: &quot;/dev/client-api/database/password&quot;,<br>    &quot;Value&quot;: &quot;AQICAHjH...&quot;,<br>    &quot;Version&quot;: 2<br>  },<br>  {<br>    &quot;Name&quot;: &quot;/dev/client-api/database/user&quot;,<br>    &quot;Value&quot;: &quot;client&quot;,<br>    &quot;Version&quot;: 1<br>  }<br>]</pre><p>The results show the two parameters stored and our password (the SecureString) is actually coming back in encoded form. If you add --with-decryption option to the CLI call the value will come in plain text, decrypted.</p><h4>Versioning</h4><p>Versioning comes out of the box and it can be a lifesaver. We are humans and we do make mistakes, by accident someone might update a password that was only stored in SSM. In situations like this you can easily go back and check the previous values for a parameter.</p><pre>$ aws ssm get-parameter-history --name /dev/client-api/database/password --with-decryption | jq &#39;.Parameters | map({Value,Version})&#39;<br>[<br>  {<br>    &quot;Value&quot;: &quot;p@ssw0rd&quot;,<br>    &quot;Version&quot;: 1<br>  },<br>  {<br>    &quot;Value&quot;: &quot;p@ssw0rd2&quot;,<br>    &quot;Version&quot;: 2<br>  }<br>]</pre><p>This is enough basic knowledge for now about the SSM Parameter Store, let’s see how we can use it for our apps.</p><h3>Using the AWS CLI to set environment variables</h3><p>For this example we are going to assume that our application requires us to set the database credentials as environment variables before it starts. We can easily do this with the help of the AWS CLI and jq. In the following example we are going to get one parameter and export it as an environment variable. (The -r option will tell jq to return raw output, that means in our case not to put double quotes around a string)</p><pre>$ export PASSWORD=$(aws ssm get-parameter --name /dev/client-api/database/password --with-decryption | jq -r &quot;.Parameter.Value&quot;)<br>$ echo $PASSWORD<br>p@ssw0rd2</pre><p>Although this gets us a value and we can do this for each of our parameters but it doesn’t scale easily, it’s a bit messy as well. Luckily there is a better solution.</p><h3>Enters confd</h3><p>confd is a tool that can compile configuration files based on templates from parameters stores like SSM, etcd, consul etc… You can download the binary and read more about it on its <a href="https://github.com/kelseyhightower/confd">github page</a>, but we are going to go through some basics.</p><p>Imagine that on the local development environment we are starting to use dotenv files, this helps the developers to quickly change parameters and gives them visibility of the configuration. A dotenv (or .env) file is just a very simple key-value assignment file. We also have a requirement to integrate with Google Maps API so now we need a new parameter for the API key.</p><pre>PASSWORD=p@ssw0rd2<br>USER=client<br>MAPS_API_KEY=42abc</pre><p>We are going to generate this file with confd which will help the developers to start the project fast without the need to run around and try to figure out which values to use.</p><p>To compose files with confd you’ll need to create a <em>resource config</em> and a <em>template</em> file and put them in /etc/confd where confd expects it. The <em>resource config</em> defines the source template, the destination file and which parameter paths should be passed to the template.</p><p>The following command creates the directories for confd.</p><pre>sudo mkdir -p /etc/confd/{conf.d,templates}</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f021f20dc47a7b0ad302c4170e1e3fac/href">https://medium.com/media/f021f20dc47a7b0ad302c4170e1e3fac/href</a></iframe><p>In the dotenv.toml resource config we pass in an array of keys that the template is going to use, if we are requesting a parameter in the template that is not included here, we will get an error.</p><p>Now that we have these in place we can run confd to generate the dotenv file. We are going to execute it in non-daemon mode -onetime, tell it that the backend we are using is SSM -backend=ssm, we limit the scope of loaded paths to the dev environment only -prefix /dev, and we are explicitly telling which region’s endpoint to use with -node.</p><pre>$ confd -onetime -backend=ssm --prefix /dev -node &quot;<a href="https://ssm.$aws_default_region.amazonaws.com/">https://ssm.eu-west-1.amazonaws.com</a>&quot;<br>INFO Backend set to ssm<br>INFO Starting confd<br>INFO Backend source(s) set to <a href="https://ssm.eu-west-1.amazonaws.com/">https://ssm.eu-west-1.amazonaws.com</a><br>INFO Target config /target/.env out of sync<br>INFO Target config /target/.env has been updated</pre><h4>How does this fit in with docker?</h4><p>With ECS one can pass in environment variables in the task definition. But this exposes some security risk as anyone who can read the task definition will see the environment variables. Instead you can create an entrypoint script that generates the config files for your application with confd. Check the github repository below for an example:</p><p><a href="https://github.com/jkrnak/confd-ssm-demo">jkrnak/confd-ssm-demo</a></p><p>The idea is that on the container start, the entrypoint script will run, it will start up confd which in turn generates the config files, then the entrypoint passes the execution to the cmd. If there issues in the config templates or perhaps you are referencing non existing keys, confd will fail with an error and your container won’t start.</p><h4>Export dotenv to environment variables</h4><p>If you application relies on environment variables you can still generate a dotenv file and export the variables with a simple command before starting the application.</p><pre>export $(cat .env | xargs)</pre><h3>Using confd for more complex files</h3><p>Confd is not limited to create only dotenv files, it can handle more complex data types it can loop through keys, you can use filters on the keys or values. In the linked repository above there is an example on creating a yaml file by looping through all keys under /client-api/database.</p><pre>database:<br>{{- range gets &quot;/client-api/database/*&quot;}}<br>  {{ .Key | base }}: {{.Value}}<br>{{- end}}</pre><p>Which will result in:</p><pre>database:<br>  password: p@ssw0rd<br>  user: client</pre><h3>Final thoughts</h3><p>AWS SSM parameter store makes it very easy to store and version parameters and secrets. You can of course set up your own etcd or consul, but once you are in the AWS ecosystem you can save some time if you use their solution.</p><p>Setting variables with the AWS CLI is simple, but doesn’t scale too well compared to confd. The CLI also takes up much more space, which might not be a problem if you are running on virtual machines but if you are using containers you probably want to keep them small. Check out the github repo above, it builds two images based on alpine linux, one with the CLI and one with confd. The confd binary is less than 6MB whereas for the AWS CLI you need python and it takes about a 100MB more space.</p><pre>REPOSITORY        TAG    SIZE<br>ssm-confd_confd   latest 10.8MB<br>ssm-confd_awscli  latest 110MB</pre><p>With confd you can write as complex configuration files as you want or can just stick with a basic dotenv, it’s up to you. It’s a very handy tool at a platform engineer’s toolkit and couple with SSM it makes your life a lot easier to deploy to different environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0bf066005fd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uniplacesgeeks/tips-and-tricks-for-aws-ssm-parameter-store-with-confd-f0bf066005fd">Tips and tricks for AWS SSM Parameter Store with confd</a> was originally published in <a href="https://medium.com/uniplacesgeeks">uniplacesgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cache control with Lambda@Edge]]></title>
            <link>https://medium.com/uniplacesgeeks/cache-control-with-lambda-edge-95645b3aa4f0?source=rss----266849bf47b1---4</link>
            <guid isPermaLink="false">https://medium.com/p/95645b3aa4f0</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[cdn]]></category>
            <dc:creator><![CDATA[János Krnák]]></dc:creator>
            <pubDate>Thu, 22 Nov 2018 11:57:06 GMT</pubDate>
            <atom:updated>2018-11-22T14:01:41.887Z</atom:updated>
            <content:encoded><![CDATA[<p><em>TLDR: check out the github repository </em><a href="https://github.com/jkrnak/serverless-lambda-at-edge">https://github.com/jkrnak/serverless-lambda-at-edge</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*i4B0pfmZ9ykP5n8RstuT3A.png" /><figcaption>Serverless makes Lambda deployment easy</figcaption></figure><p>If you are familiar with how CDNs work feel free to jump to <strong>Enters Lambda@Edge.</strong></p><h4>About CDNs</h4><p>CDNs (content delivery networks) are solving the problem of serving content to your end users fast. This is achieved by serving it from an <em>edge node</em> close to the user. Setting up a CDN for your assets (CSS, JS, photos, SVGs, etc.) isn’t a silver bullet on its own, but it can dramatically speed up the load time of your site and if caching is used it can decrease the used bandwidth from the <em>origin</em>.</p><h4>Terminology</h4><p>I mentioned two terms that we need to clarify before we move on: <em>origin</em> and <em>edge node. </em>The origin is the source location from where the CDN is loading the asset when it’s not already in the network. The edge node is a web server, a proxy that is delivering the asset to the user. In a CDN edge nodes are distributed around the globe. When users from the East Coast of the US are requesting the CSS of your page, they will get served from a node near to them and when someone from Germany is loading your page, they will connect to a server in Europe maybe even in Germany.</p><h4>What’s the point of a CDN if it connects to the origin to fetch an asset?</h4><p>A content delivery network might have their own backbone, dedicated lines thus it could serve the content faster than it would via the end user’s route, but the main advantage comes when the content is actually cached on the edge node, so there is no need to go to the origin server and load the content, it can be served immediately.</p><h4>How edge nodes cache content?</h4><p>I will limit this post to AWS CloudFront, but I’m sure other CDN providers have very similar setup. By default CloudFront caches objects for 24 hours on the edge nodes, but this behaviour can be modified in two ways:</p><ul><li>change the default TTL for all objects</li><li>use cache-control max-age, s-maxage or expires headers on the objects from origin</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*TnWunrKlfLMBlgYZ1z2nHA.png" /><figcaption>Change the default TTL or use cache headers (screenshot from AWS console)</figcaption></figure><p>You can read more about how to set this up in the <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html">AWS documentation</a>.</p><p>Changing the default TTL is easy but it applies to all objects, you lose some flexibility and you also don’t take advantage of client side caching. Unless you tell the client that it can cache the object until a certain time (expires header) or for a given period (max-age, s-maxage) the client will go the the CDN and ask for the object. The CDN might reply with a 304 (Not changed) response or it will give you the asset. (The decision is done by comparing the E-Tag header but that’s out of scope for this post).</p><p>I sense you as well thinking what I’m thinking, that round trip to just go and figure out that the logo of your page didn’t change doesn’t make much sense. Especially if you have a lot of assets and we are doing 10, 50 or more of these trips, all of this time is wasted on telling us what we could have already know, that none of these assets have changed. Luckily the solution is easy, add cache-control max-age or s-maxage header or expires header and the client will cache the content. When your assets have any of these headers it tells the browser that it can cache these files. Next time the user loads your page the browser will see that it has already cached some of these files and it won’t go and ask for them. (I should mention <em>immutable assets</em> here, this is again out of scope for this post, I might write about it in the future, until then, please google for it.)</p><h4>How can I control the cache headers?</h4><p>This is all nice, you can set these headers on your origin by either your web server, your web application etc. As a result your objects will be cached on the CDN.</p><p>What if your origin is S3? How do you set the headers then? You can add meta tags to your objects for example cache-control max-age headers and S3 will respond with those headers to the CDN. But once you have millions of objects settings these headers are not easy. S3 doesn’t allow modifying headers, you need to copy the object onto itself with the new headers, that’s a lot of operations for millions of files. Another scenario could be that you want different headers for clients from different continents, or different browsers etc. How can you do that?</p><h4>Enters Lambda@Edge</h4><p>AWS gives you a very nice serverless solution called Lambda. Serverless means that you don’t have to bother with provisioning EC2 instances, docker containers etc., you just write your function in a language that Lambda supports and it runs your code, it versions your code and it scales your code.</p><p>Lambda@Edge is a version of Lambda that can be run on edge nodes on CloudFront. It has a different pricing model compared to Lambda (no free tier). The current limitation is that you can only use Node.JS and that you need to deploy your function in N. Virginia (us-east-1) from there the function can be distributed to CloudFront.</p><p>In your function you can modify the request and response objects, headers and even the content. For example you can add the cache-control headers. (I know, very imaginative).</p><p>There are four different events that can trigger your function to launch.</p><ul><li>viewer-request when CloudFront receives a request from a viewer</li><li>origin-request before CloudFront forwards a request to the origin</li><li>origin-response when CloudFront receives a response from the origin</li><li>viewer-response before CloudFront returns the response to the viewer</li></ul><p>This is probably enough preface (it actually got a bit too long) now let’s see a use case and code!</p><h4>Example</h4><p>Use case: add cache-control header to object which doesn’t already have one. Do this on origin response this way we can cache the objects on the edge nodes when origin responds and we don’t need to execute our functions as many times as we would if we trigger the function on viewer response.</p><p>For the following example I will use the <a href="https://serverless.com/">serverless framework</a>. It’s a tool that helps deploying and versioning serverless functions for AWS, Google Cloud, Azure and a few other providers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2ba0563ddd59e0aaea9d70111576275/href">https://medium.com/media/f2ba0563ddd59e0aaea9d70111576275/href</a></iframe><p>To learn more about the event structure please have a look at the <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html#lambda-event-structure-response">documentation</a>.</p><h4>Set up the serverless project</h4><p>To set up the project, you’ll need to <a href="https://serverless.com/framework/docs/getting-started/">install serverless</a> first. Let’s assume that we have it installed. Now create the project:</p><pre>serverless create --template aws-nodejs --path lambda-at-edge --name &quot;LambdaAtEdge&quot;</pre><p>This will create us a handler.js and a serverless.yml file. Let’s replace the content of the yaml configuration with the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/53d1e4d1fb14ee449f803fbe5378ba4d/href">https://medium.com/media/53d1e4d1fb14ee449f803fbe5378ba4d/href</a></iframe><p>Now you can run the following command with the profile name for your AWS account.</p><pre>serverless deploy --aws-profile=my-profile-name</pre><p>If you don’t want to copy paste, you can clone the project from github.</p><p><a href="https://github.com/jkrnak/serverless-lambda-at-edge">jkrnak/serverless-lambda-at-edge</a></p><h4>Set up the CloudFront trigger</h4><p>We are not done yet. We have our function deployed, but it’s not being triggered, we still don’t see the cache-control headers. We now need to deploy it to Lambda@Edge. The following two screenshots will help you how to deploy it.</p><p>On the Lambda function’s screen click on the <em>Actions</em> dropdown and select <em>Deploy to Lambda@Edge</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*0pcyCo4uc-sXffwuCm-AQA.png" /><figcaption>Select Deploy to Lambda@Edge</figcaption></figure><p>On the second screen select the CloudFront distribution, the cache behaviour and the CloudFront event type. For the event type please select origin-response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*Ip6iDdHZ7LQXt4TLdGBAxQ.png" /><figcaption>On the setup screen select your distribution, which behaviour and the event type</figcaption></figure><p>Now you will need to wait until the CloudFront distribution updates. After it finished updating make a request to a resource on your distribution and check if the cache-control header is set.</p><pre># curl -I <a href="https://cdn-spa.staging-uniplaces.com/deploy.png">https://mycdn-distribution.com/deploy.png</a><br>HTTP/2 200<br>content-type: image/png<br>content-length: 52160<br>date: Wed, 21 Nov 2018 17:40:08 GMT<br>last-modified: Wed, 21 Nov 2018 16:24:10 GMT<br>etag: &quot;229ea20dd1d9ecb417b784cb746040c5&quot;<br>accept-ranges: bytes<br>server: AmazonS3<br>cache-control: public, max-age=1209600<br>x-cache: Miss from cloudfront</pre><p>In the example above the function successfully set the cache-control header.</p><h4>Troubleshooting</h4><p>If for some reason the header is not set you should check the CloudWatch logs for the function. Note that the logs will be written to a region that is close to the CDN edge node that is serving you. For example even though the Lambda is in us-east-1 it is now deployed throughout the distribution and if you are in France for example the logs of the edge function will be written to the Paris region.</p><h4>Final thoughts</h4><p>This is just a very basic idea and for some this might even be overkill. If you don’t have too many items in your S3 bucket or if you can control the meta tags on the objects it might be cheaper for you on the long run to just add the cache-control header on the S3 objects.</p><p>However if you want finer control, if you want to set different headers or serve different content based on other headers like accept-language or user-agent Lambda@Edge gives you great flexibility.</p><p>It looks like there is a plugin for the serverless framework for Lambda@Edge. I didn’t check it out but looks promising, it would help you set up everything from serverless without the need to click around on the console. <a href="https://github.com/silvermine/serverless-plugin-cloudfront-lambda-edge">https://github.com/silvermine/serverless-plugin-cloudfront-lambda-edge</a></p><p>This post got much longer than I expected it but I hope it will help you understand how to set up a Lambda@Edge function.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95645b3aa4f0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uniplacesgeeks/cache-control-with-lambda-edge-95645b3aa4f0">Cache control with Lambda@Edge</a> was originally published in <a href="https://medium.com/uniplacesgeeks">uniplacesgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Avoid pre-flight requests with AWS Application Load Balancer]]></title>
            <link>https://medium.com/uniplacesgeeks/avoid-pre-flight-requests-with-aws-application-load-balancer-f8cc5198b2bd?source=rss----266849bf47b1---4</link>
            <guid isPermaLink="false">https://medium.com/p/f8cc5198b2bd</guid>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cors]]></category>
            <dc:creator><![CDATA[János Krnák]]></dc:creator>
            <pubDate>Fri, 21 Sep 2018 07:11:17 GMT</pubDate>
            <atom:updated>2018-09-21T07:11:22.585Z</atom:updated>
            <content:encoded><![CDATA[<p>At Uniplaces we have a microservice architecture. If you are not familiar with microservices you can imagine it as having separate services around a domain or functionality. One of these services is the search API that powers our search pages and some other backend services.</p><p>When you go to <a href="https://www.uniplaces.com/accommodation/lisbon">www.uniplaces.com/accommodation/lisbon</a> a JavaScript application loads which in the background fires a few XHR requests to the search API to fetch pins onto the map and to load cards of the offers on the left hand side.</p><h4>What was our problem?</h4><p>The search API is hosted on search-api.uniplaces.com, a different domain than <a href="https://www.uniplaces.com/">www.uniplaces.com</a>, where the search page lives. Because the two domains of the API and the web page are not the same and because we had some custom headers our requests were considered not <em>simple requests </em>and triggered the browser’s pre-flight requests. In other words, www was making a <em>cross-origin request</em>.</p><p>This meant that for every GET request the browser was sending an OPTIONS requests to ask the search API if the search page can make the request. This is not ideal, it slows down the user experience because you send out twice as many requests as you really should.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*WefjybBSIMDVn8BHkPDLFw.png" /><figcaption>There is an OPTIONS pair for every GET</figcaption></figure><h4>What is a pre-flight request?</h4><p>CORS (Cross-Origin Resource Sharing) allows web pages to access content on another domain. For example, if you load www.example.com (<em>www</em> from now on) and it tries to send an XHR request to service.example.com (<em>service</em> form now on) the web browser won’t allow it because it’s not the same domain (<em>simple requests</em> can come into play here, more on that later).</p><p>Not all is lost though, <em>service</em> can configure CORS headers, that allows another origin to access its resources.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/484d6a4cd1a2e29e1c92b5be0660080c/href">https://medium.com/media/484d6a4cd1a2e29e1c92b5be0660080c/href</a></iframe><p>When the browser sees that <em>www </em>is about to access <em>service </em>it will send an OPTIONS request, in the response it sees that <a href="http://www.example.com/">www.example.com</a> is an allowed origin so it then makes the one of the GET,POST,PUT,DELETE request it was about to do at the first place. The methods that are allowed are coming back in the access-control-allow-methods response header.</p><p>If you’d like to understand CORS a bit deeper, I’d recommend reading <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS">MDN’s documentation</a> about it.</p><h4>You mentioned simple request</h4><p>Yes I did. You can avoid pre-flight requests in some very limited scenarios which MDN deems as <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests"><em>simple requests</em></a><em>. </em>Basically if you only send GET, POST or HEAD, no custom headers (see the headers allowed on the link above) and when the content-type is one of:</p><ul><li>application/x-www-form-urlencoded</li><li>multipart/form-data</li><li>text/plain</li></ul><p>This is very strict, imagine you are making POST requests with application/json body. You are out of luck, your request won’t fulfil the requirements for <em>simple request</em>.</p><h4>How could we avoid the pre-flight requests?</h4><p>You can cache the access control response for a URL with the access-control-max-age header. In this case only one OPTIONS request goes out to your URL as long as the cache of the access headers is fresh. This is maximum 10 minutes on Chrome and 24 hours on Firefox, but the catch is that each unique URL will need to be validated with a pre-flight request, as in, if you change query parameters, that’s a new URL. This way simply won’t scale for our API.</p><p>Another solution could be to move the custom headers to query parameters. For us this wasn’t an option, because even if we move the custom headers to query parameters, we need to remember next time, in weeks, in months that we are not allowed to add custom headers because that will trigger the pre-flight requests.</p><blockquote>This option won’t scale on a fast paced growing team/company.</blockquote><p>We had to find a solution that wouldn’t set us up for failure.</p><h4>Let’s see why is this happening at the first place</h4><p>Because of different origins. Because the search page and API has different hosts. So let’s put the API on the same domain as the search page!</p><p>We decided that we will have a route that will serve the requests to the search service. <a href="http://www.uniplaces.com/api/search">www.uniplaces.com/api/search</a>/* will go to the search service!</p><h4>Let’s proxy</h4><p>We could go on a few different ways about it, set up a rule on the nginx web server to proxy the requests to the API, set up some in application proxying. Luckily a few months ago we migrated to AWS’s Application Load Balancer (ALB). ALB allows you to send requests matching a host (domain) and/or path pattern to a service (target group), or do a redirect, or send a fixed response…</p><p>What we needed is to send it to a service. We already had a rule set up for search-api.uniplaces.com to go to the search service. We had to do two things to make our idea into reality.</p><p>First: set up a rule that <a href="http://www.uniplaces.com/api/search/*">www.uniplaces.com/api/search/*</a> should go to the search service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*9WIs4AZ4gqzeNq-rD2m40w.png" /><figcaption>The ALB rule based on path and host name</figcaption></figure><p>Second: as now we have a prefix (/api/search) on the requests going to the API we had to modify the service to accommodate this. We did it in a way to keep backward compatibility, we are are still serving the old routes but we server the same ones with the /api/search prefix also.</p><p>After the change, we don’t have the OPTIONS requests anymore as we stay on the same domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*7N-o7sKaA0mLQ0QJDEfu1A.png" /><figcaption>No more OPTIONS, same origin</figcaption></figure><h4>Conclusion</h4><p>If you would like to avoid the pre-flight requests, you have a few options but most of them is limited.</p><ul><li>you can try to write all your requests as simple requests, but this quickly gets hacky</li><li>you can cache the CORS headers with access-control-max-age header, but this must be done for each unique URL, difficult to scale</li><li>you can proxy the requests through your domain</li></ul><p>AWS’s Application Load Balancer is a very nice service. It allows you to set up routing based on hosts and/or paths, it allows you to redirect HTTP to HTTPS which is a common problem. They keep adding new and new features to it, it’s worth having a look if you have already bough into the AWS ecosystem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8cc5198b2bd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uniplacesgeeks/avoid-pre-flight-requests-with-aws-application-load-balancer-f8cc5198b2bd">Avoid pre-flight requests with AWS Application Load Balancer</a> was originally published in <a href="https://medium.com/uniplacesgeeks">uniplacesgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reducing reads on DynamoDB]]></title>
            <link>https://medium.com/uniplacesgeeks/reducing-reads-on-dynamodb-b0983e8bda4d?source=rss----266849bf47b1---4</link>
            <guid isPermaLink="false">https://medium.com/p/b0983e8bda4d</guid>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[cache]]></category>
            <dc:creator><![CDATA[János Krnák]]></dc:creator>
            <pubDate>Wed, 14 Feb 2018 09:20:45 GMT</pubDate>
            <atom:updated>2018-02-14T09:19:28.430Z</atom:updated>
            <content:encoded><![CDATA[<p>At Uniplaces we are helping students to find accommodations while they are studying abroad. Students can pick from shared rooms, private rooms or entire flats. In our ubiquitous language, we call these <em>offers.</em></p><p>An offer has many attributes that describes it, think about its name, price, availability. Some of these attributes are not in the <em>domain</em> of the offer (in terms of DDD) for example the neighbourhood in which the property is. On the website when we are displaying an offer we are trying to display useful informations about it for the users. This requires us to gather all these informations from different <em>domains </em>and serve it to the webpage so it can render it. We have a service for this which aggregates the entities, this service connects to different DynamoDB tables, reads all the relevant information, then merges it and returns it as a JSON object. This worked quite well, the API had reasonably fast response times thanks to the concurrency model to fetch the different domain objects. But this introduced another a problem: too many reads on DynamoDB.</p><p>Because we designed one API to serve multiple consumers we ended up loading in too many entities that might not be relevant to each consumers. We sat down and started thinking about how could we reduce the reads. We wrote up a <em>decision log </em>(I’d recommend start using this to document your team’s decision if you aren’t already doing it) about the different ideas we had:</p><ul><li>Cache entities inside the aggregator</li><li>Use DynamoDB DAX to cache</li><li>Use an HTTP reverse proxy cache</li></ul><p>We went through the pros and cons of each of these solutions, different HTTP cache providers and calculated the estimated costs. At the end (given we are running on AWS) the cheapest solution was to use CloudFront to cache the HTTP responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*Nmhefi_L4ddWPL1KZyHOHQ.png" /><figcaption>The first architecture (young and naive)</figcaption></figure><p>We drew up a solution where we cache the aggregates for a very long time and we invalidate the cached items via CDN purge requests. The problem with this is that <strong>CloudFront only gives you a 1000 invalidation requests per month</strong> and it charges a lot for any invalidation requests above this limit.</p><h4>This is not how HTTP caches should work</h4><p>When you are caching via HTTP you can set expiry headers, etag etc… The idea is that you cache your objects until you think they are valid.</p><p>I’m only going to look at time based caching here.</p><ul><li>Use expires header when you know when the item will be considered stale, for example cache today’s weather forecast until midnight today</li><li>Use max-age header when you the validity is for a specific period, cache news homepage for the next 5 minutes</li><li>Use purge when you made a boo-boo, published something to your CDN that shouldn’t have been published</li></ul><h4>Immutability to the rescue</h4><p>We had to go back to the drawing board: redesign the architecture to treat aggregates as <strong>immutable objects</strong>. But what is an immutable object? It’s just what it says on the tin, an object that once created won’t change. It won’t change its content or any attributes attached to it, if you need to change something regarding it, you will need to create a new version of it (which again will be immutable).</p><p>We can achieve this by starting to version our offers. Let’s cache each of these aggregates for a reasonably long time, for example a day, and if something changes about the offer (like its availability) we create a new version of it and serve that to our API consumers.</p><h4>But how will our consumers know the version they need to fetch?</h4><p>They could all connect to our version store and fetch the version, then do the request for the offer. This sounds like a lot of work to do, we have clients in many microservices, single page applications, web applications, changing all these would require a lot of code change, testing, release. All of these consumers do share one common thing, they all use an HTTP client to fetch the offer. So why not abstract the version logic into a service that responds with a redirect that has the version number in the url for the resource. No changes will be needed on our consumers as they all can follow a redirect response.</p><h4>The new architecture</h4><p>This architecture required us add two more services:</p><ul><li>One that is listening to changes and updates the offer’s version</li><li>One that acts as a redirect endpoint</li></ul><p>The redirect endpoint was perfect for a lambda function and the version change logic was put into one of our container cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*ENj6bPYZmuc-vKmh_QAR0g.png" /><figcaption>Second architecture (bit more complex, but based on best practices)</figcaption></figure><ol><li>When any important attribute of an offer changes we put a message on SQS. This message is read by a service that updates the version for the offer.</li><li>Consumer (HTTP Client) sends a GET for an offer aggregate.</li><li>API Gateway forwards the request to a Lamda function that fetches the version number for the given offer aggregate.</li><li>The client gets back a 302 (temporary redirect) that points to the CDN with a version number appended to the URL (http://&lt;cdn-host&gt;/offer-aggregate/&lt;id&gt;?version=&lt;version-number&gt;)</li><li>The client then follows the redirect URL</li><li>The CDN either serves a cached version of the URL if it has it already, if it doesn’t, it goes to offer aggregator directly and fetches the aggregate.</li></ol><h4>Conclusion</h4><p>We managed to drastically decrease the number of aggregate services on the cluster, which in turn allowed us to decrease the cluster’s size. Our reads on DynamoDB has decreased a lot which allowed us to decrease our provision reads. We saved a lot of money here.</p><p>We now have costs on CloudFront and Lambda but these are much less than the amount we saved on DynamoDB and ECS.</p><h4>How could we improve it more?</h4><p>This solution was a quick enough win for us to save a lot on DynamoDB reads. But this is still far from perfect.</p><p>In an ideal World we would drop the aggregator service and replace it with GraphQL. Each domain could have the same immutable architecture for their API responses and the clients could define what they actually want to fetch.</p><p>In front of our Lambda function we could cache the version responses in the API Gateway service, making even less calls to DynamoDB and faster redirect response times.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0983e8bda4d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uniplacesgeeks/reducing-reads-on-dynamodb-b0983e8bda4d">Reducing reads on DynamoDB</a> was originally published in <a href="https://medium.com/uniplacesgeeks">uniplacesgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 things I believe to be true for any product manager]]></title>
            <link>https://medium.com/uniplacesgeeks/10-things-i-believe-to-be-true-for-any-product-manager-9112e323b818?source=rss----266849bf47b1---4</link>
            <guid isPermaLink="false">https://medium.com/p/9112e323b818</guid>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[growth]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Andre Albuquerque]]></dc:creator>
            <pubDate>Thu, 22 Jun 2017 18:39:45 GMT</pubDate>
            <atom:updated>2017-06-22T20:27:43.978Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*UO79i2Jpi5GJVocNhOf-dQ.gif" /><figcaption>Image is not mine, no copyright infringement intended.</figcaption></figure><h4>A collection of thoughts from the day-to-day struggle of building product</h4><p><em>Find the original </em><a href="https://albuquerque.io/10-things-i-believe-to-be-true-for-any-product-manager-211b474bd1bb"><em>here</em></a><em> and more at </em><a href="http://albuquerque.io/"><em>albuquerque.io</em></a></p><h4>1) Product managers’ most important skill is common sense</h4><p>Voltaire said “<em>Common sense is not so common</em>”: praise the heavens it to be common around Product Managers. PMs are responsible for everything and responsible for no one. This means everyone will push for what they individually want, their own motivations (a new tech, a new tools, that new trend). <strong>Most times a good dose of common sense is what separates delivering, from failing</strong>, and aligning everyone at the table towards what is right is what makes the difference between a good product leader and a bad one <em>(props to Julio on the quote)</em>.</p><h4>2) Product management is chaos and will always be chaos</h4><p>I once again challenge a product manager to state <em>“in my startup, the process of building product is quite smooth. We plan ahead, we have all stories written, we test our designs, our developers know what to build on kick-offs, our grooming is prioritised, our backlog is rich, our checkpoints don’t require sprint changes, we don’t need to make up work to compensate delayed deliverables”</em>. Product management is plain and “simple” chaos. Either estimations went wrong and suddenly we won’t deliver on time; or there’s a “fire” and we need to solve it now; or there are countless re-opens and the sprint, which was looking so good, just went down the drain; or QA missed an edge case and a buggy feature is live and we need to roll back; or we don’t have designs ready and we can’t get them to engineers; or we didn’t have the time to build the user stories ahead of sprint estimations, etc times-a-million. Or every single one of these things is happening at the same time. Two times a day. While you’re “hangover” from the all-nighter you pulled last week because someone ran a command and killed the production database and you had to restore everything overnight. Product Management is chaos, will always be chaos, and that is why it’s amazing.</p><h4>3) Product is more about what you won’t build than what you’ll build</h4><p>Product managers are protectors of users, time, scopes and teams: there is little else that needs to be properly done in this world. Of course doing it is ridiculously hard, as they are often substitutes, not complimentary. And to add on top of it, everyone wants to prioritise their own “thing”: beautiful design, that new code language, refactor a legacy process, etc. This is unlikely to be what users value the most. <strong>End of the day, successful product management comes from prioritising what will deliver more impact considering a balance of cost (resources) and time to market</strong>. This leads to a lot of “No’s” in protection of the right “Yes”. When everything is important, nothing is important.</p><h4>4) There is always another way</h4><p>There is no single way of solving something. “Creativity is the mother of invention”, and it’s the product manager’s responsibility to kickstart this way of thinking and push every functional leader to think outside the box. <strong>Hustle because there is always another way</strong>. Make it your motto. Let everyone know: there is always another way.</p><h4>5) Holistic strategies don’t build user stories</h4><p>Avoid getting trapped on the high-level / strategy discussions for too long. Ground your team to a level that can actually get something to be built. Holistic strategies are important, but only if they can be translated into epics, user stories, tangible actions. There are few things that are more frustrating than just speaking “down the line”, “our vision”, “in an ideal world”. There is no <em>down the line</em>, <em>vision</em> or <em>ideal world</em> if we don’t build that next sprint, <em>homie</em>!</p><h4>6) There is no 9-to-5 in product</h4><p>Work-life balance is a big topic everywhere. It’s probably even bigger around startups (and investment banking) given the average age of people, high ambition and the difficulty to succeed. Even though we should all fight for a healthier lifestyle, product management can rarely afford it. There are just too many things needed to bring good products to users’ hands. <strong>And even if we don’t have direct execution responsibilities, PM’s are the foundation to keep everyone and everything together</strong>. This requires surveillance, self-awareness and an insane care for detail, as it’s easy to miss out on stuff that separates success from failure. As <a href="https://medium.com/u/c4ec9163657c">Gary Vaynerchuk</a> puts it “<a href="https://www.garyvaynerchuk.com/are-you-working-hard-enough/">are you working hard enough?</a>”.</p><h4>7) Everything takes longer than you think</h4><p>I challenge one product person to tell me the following sentance:<em> “Estimations were correct, what we built actually matched how long we thought it would”. </em>Notice I don’t even say <em>“faster than expected”</em>, I say <em>“matched”</em>. <strong>Human beings are quite bad at predicting time as we’re naturally optimistic</strong>, even after plenty of (wrongly predicted) attempts. <a href="https://en.wikipedia.org/wiki/Daniel_Kahneman">Daniel Kahneman</a> calls it the “<a href="https://en.wikipedia.org/wiki/Planning_fallacy">Planning Fallacy</a>” and goes in depth about this in “<a href="https://www.amazon.com/Thinking-Fast-Slow-Daniel-Kahneman/dp/0374533555">Thinking, fast and slow</a>”. Even if you could accurately predict development time, there is a number of exogenous variables that impact feature releases (weather it’s deploys that were blocked, QA environments/processes that bottlenecked, release processes that required extra overhead, etc). It sucks but just remind yourself and everyone around: everything takes longer than expected, 100% of the time.</p><h4>8) Getting requirements is more about what’s between the lines</h4><p>Collecting requirements from stakeholders, both internally and externally, is like a game of darts: rookies think that winning the game means aiming at the bullseye, while in reality there are rules and the centre is not always the highest scoring target. Users explain their problems using solutions, or how they see their problems being solved. This is a natural compensation mechanism. The issue is that the side of the brain that processes a problem is different from the side of the brain that thinks of a solution. <strong>PM’s should be experts on problems, not solutions</strong>, so it’s key to look for the problems between the lines to get to root causes. Try using “<a href="https://hbr.org/2010/04/the-five-whys-for-startups">the 5 why’s</a>” to force your users into their problems and away from their solutions.</p><h4>9) Silver Bullets don’t exist. Period</h4><p>If you build product in a startup, it’s normal to be close to founders. Founders are idealistic and optimistic. So optimistic that they believe it’s that “one little thing” that will make the business explode. This is what people call “a silver bullet”. Don’t be fooled: silver bullets don’t exist. It doesn’t matter how much media tries to mask them with overnight successes, it wasn’t “silver bullets” that made top startups successful. At best, something that looks like a “silver bullet” could bring a better experience but don’t expect double or triple digit growth. <strong>Growth comes from consistency over time</strong>: delivering endless iterations and features which are user-fit, solve problems, and incrementally improve retention and/or conversion.</p><h4>10) Don’t ship features and forget about them. Don’t be a factory</h4><p>One of the most impactful articles I’ve read in a long time was <a href="https://hackernoon.com/12-signs-youre-working-in-a-feature-factory-44a5b938d6a2?gi=16fabafa0a6b">“12 signs you’re working in a feature factory”</a>. This really resonated with how we we used to build product at Uniplaces, plain and simple. And the worst part is that a significant number of product teams around the world work this way. When I interview for product positions I generally ask a question: «Do you think the world needs more products?»: my answer is “<em>Yes because the world needs better products and the way to get there is through competition, and the more good products are built the more great products are built”</em>. The thing is the <strong>standard of product quality determines the speed of innovation</strong> (or how fast products get great) and shipping bad features, bad experiences, poor problem understanding, does a disservice to this cycle. Build and ship what people want, and if you end up building something people don’t want, you need to be emotionally unattached to kill it, as easy as when you brought it to life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9112e323b818" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uniplacesgeeks/10-things-i-believe-to-be-true-for-any-product-manager-9112e323b818">10 things I believe to be true for any product manager</a> was originally published in <a href="https://medium.com/uniplacesgeeks">uniplacesgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Alexandre Santos]]></title>
            <link>https://medium.com/uniplacesgeeks/meet-alexandre-santos-236d66e74878?source=rss----266849bf47b1---4</link>
            <guid isPermaLink="false">https://medium.com/p/236d66e74878</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[meetthegeeks]]></category>
            <dc:creator><![CDATA[Andre Albuquerque]]></dc:creator>
            <pubDate>Mon, 16 Jan 2017 14:17:07 GMT</pubDate>
            <atom:updated>2017-01-16T14:20:43.804Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*UuvcZO1MPYGFsx2WjwOWtA.png" /></figure><p>At Uniplaces we’re creating an open and sharing culture and we believe one of the best ways to do it, is to actually let everyone know a bit about each one of us.</p><p>In the second interview of “<em>Meet the Geeks” </em>we present you Alexandre Santos, a recent talent acquisition to the front-end development team. Let’s know a bit about him!</p><h4>What was your path to Uniplaces ?</h4><p>My first experience developing was somewhere in 2011 when I was in my Hardware Maintenance course in Escola Técnica e Profissional de Mafra. Two years later I joined a start-up as an intern in and at the time I wasn’t even developing. However, my interest for software development was there, I had the awesome opportunity of being with great developers for 8 hours a day, I knew I could learn a lot and that was something I would want to do for my career. I kept doing a lot of side projects with friends, reading, and asking lots of questions until I found myself being skilled enough to take that job as a software developer.</p><p>Then one day, the company gave me the opportunity to transform one of my biggest hobbies into a full time job, I’ve obviously said yes without thinking twice! Since then, almost two years passed, I’m still learning a lot (and I think I will always be). I’ve also embraced other challenges along the way, until I find I wasn’t evolving enough. It took me a conversation with <a href="https://www.linkedin.com/in/mlimaloureiro">Miguel Loureiro</a> to understand that Uniplaces’ ambition, team and spirit were what I was looking for. I felt I could fit and contribute to company’s objectives and I couldn’t be happier with the decision I made 3 months ago!</p><h4>How much do you enjoy working here?</h4><p>At first look, everyone that has been in our office thinks about how amazing it is to work in a place like this in Rossio’s Train Station, Lisbon. From my three months here I can say that the office is nothing compared with all the others things we have. Starting from having a very talented team where people really like each other (we keep going out on dinners and lunches a few days per week), the opportunity and freedom given to everyone and the feel that you are involved in company’s achievements is undoubtedly one of our biggest “perks”.</p><p>More than being part of the engineering team, I think everyone around here feels part of the bigger Uniplaces team, and that is somehow reflected in the business’ success.</p><h4>If you had to pick the most impactful task you’ve been assigned for at Uniplaces, which one would you pick?</h4><p>As you can imagine, I’m still a new joiner and I’m still discovering a lot of things about the business and the company itself.</p><p>However, I think the most impactful thing I’ve been doing is implementing our new design language across platforms and improving our open source SASS library (UniQ). It is an ongoing job that is being done by the whole front end team and I’m really proud to be part of it!</p><h4>What’s the kind of people you like to work with?</h4><p>I think this question could really be “how’s Uniplaces team?”. And I say that because I don’t think there is anyone who wouldn’t love to work in an environment where everyone is always sharing knowledge, suggesting new things you can learn and giving feedback about your work. It is awesome how much you can learn at the end of the day! Driven, talented, nice and funny people are for sure the people I want to work with!</p><h4>Given your level of seniority, how much do you think you can grow here ?</h4><p>As I said, this is definitely one of the biggest reasons I end up joining Uniplaces! Giving the number of awesome and diverse people I have the pleasure to work with, I’m sure I can grow a lot. I’m also sure that Uniplaces has no problems giving that opportunities for anyone who wants to grow.</p><p>I feel my skills improving day-by-day and I think that’s what you want to feel when you want to be a top notch professional in what you do! I really fell Uniplaces being the right place for me to develop my (still short) career in Software Development.</p><blockquote><strong>Interested in joining the engineering team at Uniplaces?</strong></blockquote><p>Check our <a href="http://careers.uniplaces.com/">Careers Page</a> and select “Engineering and Technology” to find the open positions for the team. If you feel you’re a rockstar and none of the positions match, feel free to email us at <a href="http://jobs@uniplaces.com/">jobs@uniplaces.com</a>.</p><p>Checkout more blogposts from our product, engineering and design team at <a href="https://geeks.uniplaces.com/">https://geeks.uniplaces.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=236d66e74878" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uniplacesgeeks/meet-alexandre-santos-236d66e74878">Meet Alexandre Santos</a> was originally published in <a href="https://medium.com/uniplacesgeeks">uniplacesgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we built our new search applying Jobs-To-Be-Done]]></title>
            <link>https://medium.com/uniplacesgeeks/how-we-built-our-new-search-applying-jobs-to-be-done-f54c39a81539?source=rss----266849bf47b1---4</link>
            <guid isPermaLink="false">https://medium.com/p/f54c39a81539</guid>
            <category><![CDATA[stories]]></category>
            <category><![CDATA[product-design]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[jobs-to-be-done]]></category>
            <category><![CDATA[product]]></category>
            <dc:creator><![CDATA[Andre Albuquerque]]></dc:creator>
            <pubDate>Fri, 11 Nov 2016 20:19:58 GMT</pubDate>
            <atom:updated>2016-11-11T20:27:38.316Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pd6GQSH3FvraR_srYTgc4A.png" /></figure><p><em>Find the original post </em><a href="https://albuquerque.io/how-we-built-our-new-search-applying-jobs-to-be-done-8fdc51dc10c3#.dvj522hfi"><em>here</em></a></p><p><a href="http://uniplaces.com/?utm_source=albuquerque">Uniplaces</a> is building the most beautiful way of living your student experience. This is a lofty and wide-scoped goal so we started by rethinking how you find and book your new home, challenging the decades-old sucky experience of classified ads portals and <em>scammy forums</em>. Needless to say this is a big challenge as moving abroad means “leaving” your family, friends and loved ones. Adding on top of this, as the majority of the audience is experiencing this rollercoaster of emotions for the first time in their lives, the word “responsibility” gets a whole new meaning.</p><p>At our company the product organisation is quite new (comparing to the company’s lifetime), so we are always trying new ways of understanding what to build and how to do it. Many startups have been applying the “jobs-to-be-done framework” (JTBD), and job stories seemed the perfect challenge for our next feature. When dug into data and feedback from our users and team, we realised we needed to completely re-think <strong>search</strong>.</p><p>Uniplaces’ job story (“<em>solve all student needs so that they feel safe and enjoy their experience”</em>) is too broad to build on an agile environment, so we narrowed it to “When I am moving abroad, I want to find the right place so I can feel at home”. “<strong>Find”</strong> is key here: to get us to be “hired”, we needed the search experience to be flawless, easy and fit the user’s preferred way of finding something. Our previous design of the search page was quite simple but it taught us quite a lot about our users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x8xg8p3CyywxJgXRMDFtSA.png" /><figcaption>Uniplaces’ old search</figcaption></figure><h3>So what did we build?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pd6GQSH3FvraR_srYTgc4A.png" /><figcaption>Uniplaces’ new search on web and mobile</figcaption></figure><h4>Micro-jobs — 3 shades of search</h4><p>By learning how our users were searching for homes, we actually found 3 different behaviours that seemed like individual jobs: the first one is “<em>When I am searching, I want to use the map so I can connect prices with locations</em>”; we see this as a user <strong>hiring the map</strong>. The second one is along the lines “<em>When I am searching, I want to filter down so I don’t lose time</em>”; here the user is <strong>hiring the filters.</strong> The third and final one is “<em>When I am searching, I want to see everything so that I select what seems to fit</em>”; here the user is <strong>hiring the information in our listing cards and our algorithmic sorting. </strong>Uniplaces isn’t the only one being hired for a job, Uniplaces’ search is also being hired and it has at least 3 “customers” to please.</p><h4>1. Building for user hiring the map</h4><p>Map-driven users cared mostly about map navigation and information to tailor their potential choices. They relied on the map feedback to select rooms and houses that could fit what they were looking for.</p><p>In real estate tech generally 2 things matter: price and location, but when you never rented nor lived abroad, you have no idea what to pay or where to live. To turn this around we added pricing to our map pins (a common practice), and added secondary aggregate pins spread across the entire city. These decisions allowed a map navigation to 1) offer pricing clusters and city distribution (so you focus in the areas that fit your budget), 2) show the power of supply and reach of what Uniplaces has to offer, and 3) make it easy to navigate from area to area, highlighting our recommended offers ahead of all options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*GunIUGCGGThxLpI8KmlCUQ.gif" /></figure><h4>2. Building for a user hiring the filters</h4><p>Filters-driven users preferred to zoom out at city level and customise filters to their exact needs. Their search was binary: “either you have the offers (and the filters) I want or I am off.”</p><p>People’s brains lean towards finding shortcuts to fasten decisions. Filters are shortcuts and we were looking for the fastest path to output what our users wanted. Applying the Pareto principle we learnt that 80% of room search applies the path “<em>Where &gt; When &gt; What &gt; How much</em>”, so we built a one lane design following this structure. It helped save screen estate, keeps the user on the behaviour and it guides towards the advanced option (which previously was rather hidden).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*N5yobXYO7p9xdpyVpfYphQ.gif" /></figure><p>Advanced filters were also revamped: most marketplaces suffer from low supply utilisation rate (i.e. a large majority of users tend to check a small percentage of supply). To disperse and grow this metric we made advanced filters more clear, added suitability options targeting each person’s specific profile (erasmus, professional, etc) and finally added this option in mobile, previously non-existent.</p><h4>3. Building for a user hiring the “popular”</h4><p>Finally some users default everything and prefer scrolling through our “popular” ranking and open something that fits. To assess they relied on what the search cards showed, photos and prices.</p><p>These users are the hardest to please: since we knew little about their preferences we still needed to offer a “healthy” experience. Digging into data from our “default” users we realised they were seeing around 50 different options before converting, and a single search visit would lead to open around 20 different options. Our users told us this happened because we didn’t show enough information on the search card! We decided to add to the container key snippets like neighbourhood, star rating, property type, floor plan or video, bills information, made the verification mark clearer, added more characters to the title and the rebuilt the mobile photo navigation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*KXQdTXsdRgoD6SBr9pZpeQ.gif" /></figure><p>Every tweak aimed at improving “<em>passive understanding</em>”, in other words making a user decide, from search, if it’s worth actively opening a specific listing. If we can reduce offers seen from 50 to 25 we might halve time to purchase. This is even more important for users not using a filter or a location search.</p><h3>Did it work?</h3><p>Measuring success was central to rebuilding this feature. Although we track the ordinary metrics like conversion rates, bounce rates and in-page NPS, these suffer heavily from seasonality and we wanted to single out metrics tied to the feature. We decided to seek a “healthy” search experience and, based on historical converting data, rounded at reducing searches with less than 10 results and mitigate zero results searches, while increasing the number of times users got over 20 different results.</p><p>Our data team works side by side with product to closely measure impact, and for this exercise we used a sample of searches and our internal <em>R package</em> called <strong><em>UniplaceR</em></strong> to move, clean and prepare the raw data, as well as share analysis and results. To reduce unpredictability and deviation we excluded searches without explicit user input. Finally we applied a smoother based on the generalised additive model method (GAM).</p><p>We launched in mid July, and after a couple of weeks of testing here are the main results in comparison to a sample from March to June.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*SVqLaJmQfuR0ivKaPpr35w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*z2jVUrMYNJSx-_BA1meWOg.png" /><figcaption>% of searches outputting &lt; 10 results (left), % of searches outputting zero results (right)</figcaption></figure><p>In terms of our “unhealthy” experiences we noticed a significant drop, reducing searches with less than 10 results by 44.89% (~27% from ~49% of searches) and searches with zero results by 42.9% (~8% from ~14% of searches). We also drove down the standard deviation, key to provide a more consistent experience and help us learn faster and iterate with more confidence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*CuGsoz1ho6aehTAe3DtbHw.png" /><figcaption>% of searches outputting &gt; 20 results</figcaption></figure><p>The best part of this was the compound effect of also improving the “healthy” experiences. We saw an amazing increase of 45.46% of searches outputting more than 20 results without re-arranging our algorithm (64% from 44% of searches). The fact that, for the first time, more than 50% of experiences with our search are “healthy” will have a deep impact on conversion and NPS.</p><h3>Conclusion</h3><p>This was the first time we tried to follow JTBD framework, beginning to end, across product, design and engineering. It forced us to look differently at features: not by their specs or designs, but rather by preferred interaction to solve a problem. It made us gravitate basically around the users’ behaviour when hiring the product instead of our assumed scope. In the end, users gained the most and Uniplaces moved one step closer to “<em>solving all student needs so that they feel safe and enjoy their experience”.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f54c39a81539" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uniplacesgeeks/how-we-built-our-new-search-applying-jobs-to-be-done-f54c39a81539">How we built our new search applying Jobs-To-Be-Done</a> was originally published in <a href="https://medium.com/uniplacesgeeks">uniplacesgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>