Solving imaginary scaling issues

Michele Riva

Michele Riva

Senior Software Architect @NearForm

Google Developer Expert

Microsoft MVP

MicheleRivaCode

Real-World Next.js

Build scalable, high performances and modern web applications using Next.js, the React framework for production

MicheleRivaCode

MicheleRivaCode

Scalability

Software scalability is an attribute of a tool or a system to increase its capacity and functionalities based on its users’ demand. Scalable software can remain stable while adapting to changes, upgrades, overhauls, and resource reduction.

Source: https://fullscale.io/blog/what-is-software-scalability

MicheleRivaCode

MicheleRivaCode

Scalable software can remain stable while adapting to changes, upgrades, overhauls, and resource reduction.

MicheleRivaCode

The system should remain stable when applying any kind of change to both the infrastructure and application

Changes

e.g., switching from Compute Engine to Cloud Run to make the whole infrastructure more cost-effective

MicheleRivaCode

The system should remain stable when upgrading any of their components

Upgrades

e.g., releasing a new software version or upgrading the runtime

MicheleRivaCode

The system should remain stable during maintenance and debugging

Overhauls

e.g., if the system is not working properly, it should be easy to inspect production deployments

MicheleRivaCode

The system should remain stable
under high load

Resource reduction

e.g., an e-commerce is rolling out a great promotion with huge discounts, there's a lot of traffic on the website and the connection should remain stable

MicheleRivaCode

just 4 scenarios

MicheleRivaCode

imaginary issue #1

"This programming language doesn't scale"

MicheleRivaCode

MicheleRivaCode

MicheleRivaCode

MicheleRivaCode

imaginary issue #1, debunked:

You're not Facebook, Twitter, or WhatsApp

MicheleRivaCode

MicheleRivaCode

MicheleRivaCode

  • How many active users do you have today?
  • How many active users do you expect to have in five years from now?
  • How much would it cost to teach your whole team to code in Erlang, Rust, C++, Scala, or any other "highly scalable" language?

MicheleRivaCode

MicheleRivaCode

imaginary issue #1,

debunked (again):

Good PHP code scales better than bad Erlang code.

Good Ruby code scales better than bad Scala code.

MicheleRivaCode

imaginary issue #2

"We need to use cloud functions to manage high traffic. Serverless computing scales better"

MicheleRivaCode

MicheleRivaCode

  • 5GB free
  • $0.12 per GB

Networking

  • 128MB RAM, 200MHz CPU: $0.000000231 per 100ms
  • 1024MB RAM, 1.4GHz CPU: $0.000001650 per 100ms
  • 8192MB RAM, 4.8GHz CPU: $0.000006800 per 100ms

Compute time

  • First 2M free
  • Beyond 2M $0.40 per million

Invocations

MicheleRivaCode

Simple REST API example

Let's say we have a simple but critical REST API that gets 50 requests per second (129,600,000 requests per month).


The average execution time is 300ms.

We can use the cheapest RAM option (128MB).

We require around 100kb of bandwidth per execution.

MicheleRivaCode

MicheleRivaCode

Simple REST API example #2

Let's say we have a simple but critical REST API that gets 100 requests per second (259,200,000 requests per month).


The average execution time is 300ms.

We can use the cheapest RAM option (128MB).

We require around 100kb of bandwidth per execution.

MicheleRivaCode

MicheleRivaCode

MicheleRivaCode

MicheleRivaCode

imaginary issue #2, debunked:

Cloud Functions are good at managing spiky and unpredictable traffic

MicheleRivaCode

MicheleRivaCode

imaginary issue #3

NoSQL databases scales better than RDBMS

MicheleRivaCode

MicheleRivaCode

Companies actively using sql databases

  • Facebook
  • Uber
  • Netflix
  • Instagram
  • Spotify
  • Instacart
  • Twitch
  • Reddit
  • Stackshare
  • RobinHood
  • Revolut
  • Trivago

MicheleRivaCode

Good PHP code scales better than bad Erlang code.

Good Ruby code scales better than bad Scala code.

Remember?

MicheleRivaCode

Good MySQL knowledge is better than any NoSQL poor knowledge

Good experience with PostgreSQL is better than no experience with NoSQL

imaginary Issue #3, debunked:

MicheleRivaCode

imaginary issue #4

We need everything custom, so it fits our use case 

MicheleRivaCode

MicheleRivaCode

Frameworks

MicheleRivaCode

Frameworks already provide everything we need to implement most of the custom business logic we need in our apps

imaginary Issue #4, debunked:

MicheleRivaCode

how do I determine if my application is really scalable or not?

MicheleRivaCode

Is my team scalable?

MicheleRivaCode

Are we adopting this technology because we're excited about it, or are we doing this because it's the best solution to our problems?

MicheleRivaCode

Do we know our app traffic?

MicheleRivaCode

But I want to have fun!

MicheleRivaCode

MicheleRivaCode

@MicheleRiva

@MicheleRivaCode

/in/MicheleRiva95

www.micheleriva.dev

Solving imaginary scaling issues

By Michele Riva

Solving imaginary scaling issues

  • 380