Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is nginx / node.js / postgres a very scalable architecture?

I have an app running with:

  • one instance of nginx as the frontend (serving static file)
  • a cluster of node.js application for the backend (using cluster and expressjs modules)
  • one instance of Postgres as the DB

Is this architecture sufficient if the application needs scalability (this is only for HTTP / REST requests) for:

  • 500 request per seconds (each requests only fetches data from the DB, those data could be several ko, and with no big computation needed after the fetch).

  • 20000 users connected at the same time

Where could be the bottlenecks ?

like image 376
Luc Avatar asked Nov 17 '11 13:11

Luc


People also ask

Is node js highly scalable?

Where Node. js really shines is in building fast, scalable network applications, as it's capable of handling a huge number of simultaneous connections with high throughput, which equates to high scalability.

Why Nodejs is highly scalable?

Node.js offers Easy Scalability js uses a single thread to handle non-blocking I/O calls, which means that it'll take fewer resources for the application to accept concurrent connections compared to traditional approaches.

Should I use Nodejs or nginx?

Conclusion. Node. js is a JS runtime environment that is also an HTTP server with some event-driven features and has many drawbacks in terms of concurrency and high load or user requests to handle a large number of users concurrently. Nginx has the best performance in this case, and it provides the best performance.

Is node js compatible with PostgreSQL?

Using node-postgres , you will be able to write Node. js programs that can access and store data in a PostgreSQL database. In this tutorial, you'll use node-postgres to connect and query the PostgreSQL (Postgres in short) database. First, you'll create a database user and the database in Postgres.


1 Answers

For the specified load (500 simple requests/second), I wouldn't have thought that this will be too much of a problem. And my guess would be that a cluster of node instances will not even be necessary.

However, as you've only got a single instance, when it comes to scaling up, that is most likely going to be your bottleneck. You've also got the additional issue that this would be your single point of failure (I'm not familiar with Postgres, here were working with an Oracle cluster and dataguard which means that we've got a backup database cluster to mitigate that).

If you do not require a relational data model, then something MongoDB may be a more scalable choice.

One other thing to bear in mind is your network infrastructure. If you are going to add clusters/nodes, then make sure that the network can handle the distributed load.

One last thing: Generally, it is impossible to determine whether an application on an architecture can handle a particular load without performance/volume/stress testing, so the answer is a resounding "maybe".

like image 109
beny23 Avatar answered Sep 28 '22 20:09

beny23