Building Freetrade

Why we use serverless architecture at Freetrade

Mathias Dewert

June 18, 2018

Mathias Dewert

If you’re technical and new to serverless, you might be thinking, “my life would be so much better if my stack worked this way.” You’re right.

Hi, Mathias here! I’m a backend engineer at Freetrade and we approach our backend operation with the same sense of innovation as everything in our stack.

Far and away, one of the coolest features is our serverless architecture. This is going to be a big buzzword soon, just like machine learning or big data.

So to keep everyone ahead of the curve, let’s dive a little bit into serverless

Goals:

  • Introduce and demystify serverless
  • Outline the advantages and why we use it at Freetrade

Quick note: this article is not built for technical experts (we’re going to follow up with a little more detail for you). It’s more targeted towards a curious audience interested in knowing how things work behind the scenes and the key concepts of how our operation runs.

What is serverless?

Serverless is an innovative approach to sourcing server resources, which allows you to buy and use your resource in response to to real-time demand.

Let’s be clear from the start. Serverless does not mean there are no servers! 😁 Everything needs servers.

It just means that as a developer and a company, we don’t have to worry about them (as much). The work is cut out for us by giant service providers (Google in our case, or Amazon, Microsoft etc).

Second clarification: When we talk about serverless here in this article we really refer to FaaS.

Not PaaS, which could also be included under a broad defintion of the serverless term, but is more often put under the “cloud” umbrella. And is therefore so 2012.

Serverless is basically a step up from cloud. With cloud servers, you don’t maintain your own dedicated servers; instead you purchase your capacity and capabilities ahead of time.

But with serverless architecture you purchase and equip your server usage in real-time. You only ever use what you need, when you need it.

If cloud servers are like renting a car, serverless is like ordering an Uber.

Image for post
But without the awkward ‘talk or silence’ dilemma

Advantages and why we use it at Freetrade

So why go serverless and what’s the hype all about?

There are two major advantages

  • Faster deployment and shipping
  • It costs less 💸

Why does it allow us to do things faster ?

Product development is a race towards greater abstraction, as engineers, and even more as product developers, we don’t want to have to reinvent the wheel all the time.

We want to solve a problem, and abstract it away so that no-one has to deal with it in the future.

Image for post
So we can do more of this!

Serverless (FaaS) is the current pinnacle. The result of decades of software developers learning from their mistakes, encapsulated in little building blocks of proven technologies: readily available to everyone and waiting to be picked up and assembled into great ideas.

Here at Freetrade we’ve decided to use Firebase functions. These allow us to quickly apply the logical bits we need to save, check, or transform our data.

No boilerplate code or operational nightmare to get our code running; we focus solely on what we want to achieve and only have to write the logic for that one bit.

By doing that we were able to completely reduce fully fledged services to only a few lines of code, which then deploy, run and scale automatically => Faster to write, faster to run…

Why is it cheaper?

For a startup, saving money is of the utmost importance and it would be impossible for us to build and maintain our own servers in-house. Fortunately those days are long gone.

Product developers and innovators can now request and access on-demand computing power with fantastic granularity and at incredibly low costs.

Not only do we only have to develop the bits we need, we also only pay when these bits are actually used!

Not so long ago we would have had to rent an entire machine (extreme vulgarization here), running continuously, day and night, completely detached from our actual load and needs.

Image for post

We would be paying for the entire resources of the machine, even if we only needed a tiny fraction of it at times.

So many resources going to waste, so much money going to waste.

Now with serverless it’s almost like having a computer that knows when to grow, or when to shrink, when to go to sleep and when to wake up, to the point that it perfectly fits the exact resources you need at all time.

You know how Amazon optimizes its delivering business by using boxes of the same size completely unrelated to how much space your item takes up? (You do now).

Image for post
Literally just a toothbrush

They use the exact opposite strategy when it comes to selling serverless.

They provide you with adaptive boxes, that fully fit your code and only your code, ready to be shipped at a moment’s notice.

They will also give you access to as many boxes as you need when you need them (which hopefully for us will be a lot!)

That advantage means we only allocate totally necessary budget to our servers and massively reduce our operational needs.

It’s a smarter, faster, cheaper and more flexible way to build. It’s probably even better for the environment too!

Image for post
“Thanks, Serverless”

Now, you’re up to date on the need-to-knows of serverless. If you’re non-technical, you can deploy this at parties to seem cutting edge.

If you’re technical and new to serverless, you might be thinking, “my life would be so much better if my stack worked this way.” You’re right.

~Mathias, Backend engineer

Important Information

This should not be read as personal investment advice and individual investors should make their own decisions or seek independent advice.

When you invest, your capital is at risk. The value of your portfolio can go down as well as up and you may get back less than you invest. Past performance is not a reliable indicator of future results.

Freetrade is a trading name of Freetrade Limited, which is a member firm of the London Stock Exchange and is authorised and regulated by the Financial Conduct Authority. Registered in England and Wales (no. 09797821).

Sign up for our newsletter

Download the app and start
investing now.