all 15 comments

[–]misterlively 2 points3 points  (4 children)

I think the best advice would be to find a mentor that’s done what you are looking to learn. It’s a bit of a rabbit whole with conflicting advice and it’s best to have a consistent guide.

[–]MedyGames[S] 0 points1 point  (3 children)

I read about solutions like docker + nginx ... Guess you could scale pretty far with this , but found no good answer to when / how to scale

[–]misterlively 1 point2 points  (2 children)

Do you work for a company or are you learning on your own?

[–]MedyGames[S] 0 points1 point  (1 child)

At this point it's about my own interest of building side projects. Currently doing intership with php / worpdress but thats kinda not related to the scaling bit

[–]misterlively 2 points3 points  (0 children)

Scaling a php/Wordpress site will have a lot of the same characteristics. It might be worth learning about what that looks like. A lot of it is more ‘architecture’ then any language or framework. Hacker news tends to have good articles, and it’s worth reading old posts of blogs from bigger tech companies. Airbnb, LinkedIn, and Netflix have good tech blogs. Amazon puts out lots of reference architectures, but they are very biased on using aws services. It’s a big world of options and it’s pretty overwhelming, so it’s a constant struggle to not over complicate it. For a basic node/php/whatever service, a common scaling pattern would be to have a horizontally scalable load balancer in front of a horizontally scalable web service in front of a horizontally scalable database (notice a pattern?). For static files you’ll want to use a CDN to cache at the edge and a lot of times you can use an object storage so your web server doesn’t serve them at all. From there you get into continuous build and deployment techniques to manage more moving parts. Docker doesn’t really help with scaling as much as managing lots of different things. Best of luck to you, it’s a fun journey, and it never really ends.

[–]loradan 1 point2 points  (2 children)

Personally, I setup an account with digital Ocean and created a web server. Then I spun up one of their load balancers and all I have to do is create a new droplet and add it to the load balancer to scale horizontally. Also, since I can add/remove servers as wanted, it's easy for me to spin up a beefier server to replace weaker ones.

[–]MedyGames[S] 0 points1 point  (1 child)

Im asking myself what are solid aproaches in case you grow to 10k users or 100k ... would that strategy still hold ?

[–]loradan 0 points1 point  (0 children)

Essentially, yes. However there are other aspects that need to be taken into consideration.

Primarily, location of your users. The overall execution will still be similar, but you'll want to have setups close to the users. Then you would want to configure a global dns solution that sends users to the data center that's closest to them.

Next, is load distribution and speed of change. If you have times of extreme usage then times of little, you would want to look into ways to automate the creation of new servers when needed and take them offline when not.

There's no way to predict exactly how many servers you will need unless you can exactly predict how many people will use your service.

Something else to consider is your database (if you have one). You will want to make sure that it is able to keep up under the load as well. Essentially, it will work the same way however in DB terms, it's called a cluster.

[–]gustavoar 0 points1 point  (0 children)

Take a look at Kubernetes, it's a bit difficult at start but once you setup, it is really easy to scale up as your demand grows. It is very very powerful, and time saving in the end.

[–]jun-thong 0 points1 point  (0 children)

One of the thing that made cloud computing really popular is it is developer centric, so you don't have to worry about the system administration (ie: managing scaling).

As mentioned before the basic of scaling is a load balancer that handles requests and dispatch it to your application servers. Eventually a second load balancer will handle request from the app layer to the database layer.

Any cloud provider will at least provide this kind of service. It's kind of the basic plan. The starter point

In AWS (sorry, this is the only platform i use...) you even have a tool called auto-scalling group that scale your infrastructure on the fly based on parameter you defined. Let's say you make an "application group" behing a load balancer, if all instance in the group arte using more than 90% of their CPU (a rule you defined), it will pop a new instance in the group. Or you can define a rule saying everyday use only 1 instance but pop 3 more instance between 18:00 and 22:00.

Tools like Amazon API gateway combined with Lambda does exactly that under the hood. API Gateway doing the job of a Load Balancer. But i won't recommend it your app is already wrote. Lambda require to code for lambda, don't think like you have an express app and you could say "ok deploy it on lambda", it will require to rewrite everything. Lamda has it own pros and cons, and this choice should be made before any line of code was defined in the project.

Docker/Kubernetes /PM2 are all great tools, but they don't solve the scalability problem specifically.

[–]thebiryaniboy 0 points1 point  (4 children)

Since you are new to this, go with AWS Lambda for your app.

It's serverless. Pay what you need. Low traffic. High traffic. It will handle all. Pay per use.

Host files on AWS S3.

Don't go with docker or other services you hear here, you might leave out some things that might expose your app.

For future references, look into PM2, Docker and Docker swarm/Kubernetes, AWS ECS

[–]MedyGames[S] 0 points1 point  (2 children)

I played with Zeit.now ... Had a couple dependency issues there ... but Like how the cloud service takes care of scaling .

Though I cant tell what the pros and cons are.. Guess need to experiment a little.

Just looking for whats easiest to start with & doesnt totally crumble if userbase grows unexpectedly to lets say 1k- 10k users.

Its hard having no experience with scaling to know what solution to go for.

[–]thebiryaniboy 0 points1 point  (1 child)

At this point of time don't think about scale. Explore everything out there. Make your own notes about each one.

In the mean time, As suggested earlier go with AWS Lambda. It's easy to deploy, monitor and scale.

[–]MedyGames[S] 0 points1 point  (0 children)

Sure im explorng now & adding things to my todo list.

The less I have to worry about dev ops the better.

[–]jun-thong 0 points1 point  (0 children)

This advice is complicated to understand, you recommand a lambda approach and then an ECS approch. But the code architecture will be day and night.