简体   繁体   中英

Is Express the most scalable application framework for NodeJS?

I'm not really familiar with other Node based web application frameworks other than Express. Despite that, it seems like Express is very light-weight for what it can accomplish. However, the only time I have used Express is for small, experiment projects and nothing that serves a lot of users. So I was wondering, should I expand my knowledge to other frameworks that serve this "scalability" metric and if so, what are they?

Express has similar scalability as other servers like nginx and Apache. It has pretty much all the same considerations.

If you want to scale way up, the best way would be (just like with nginx and Apache) to write your application in a way that you can have multiple instances of the server running (and then use a load balancer to wire them together).

This requires taking into account how sessions would be handled, but that isn't a problem that is unique to Express. In fact, the express-session package which is the default for sessions makes it really easy to have database-based sessions which makes it a non-issue

The one special consideration would be, if you are running them on a multi-CPU-core server, since Node is basically single-threaded, it can also be helpful to spin up one instance per CPU core to maximize performance. This can cause a bit of a performance hit compared to something that is natively multi-threaded, like nginx, but is only applicable if you're trying to use a few really beefy servers. It's much more common in to use lots of little servers instead for scaling.

Beyond that, it pretty much works like any other.

Comparing it to other possible Node-based servers, it should performance just as well as any of them could. Because it's so light-weight, there isn't much that could be optimized out of it.

We use express servers to serve very large projects and have never had any issues. We just scale them up and away they go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM