Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Minimal software/hardware stack for web API
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Minimal software/hardware stack for web API

I'm looking to build a web API that connects to a remote MySQL server, runs a select query, does light manipulation of the result, and delivers it in JSON form over HTTP.

I need a software stack that is capable of serving 100+ concurrent connections using a minimal amount of CPU and memory. I'm on a low-end budget and would love to use one of RamNode's server packages. However if you can recommend a provider that would be good for this sort of thing I'm open to suggestions.

Nginx + PHP-FPM is pretty much out of the question as I'm sure the PHP overhead would greatly increase the memory usage. I would imagine that a NodeJS + Express solution might work better, however I'm interested if anyone else has any suggestions that may offer greater efficiency.

Thanks for your suggestions in advance.

Comments

  • vapornodevapornode Member
    edited August 2016

    I would recommend the NodeJS + Express route for this. Not only does this software provide an easy way to rapidly develop a REST API that spits out JSON, but it is also very light on the resources.

    The default NodeJS V8 engine allows for thousands of concurrent connections with relatively low CPU and RAM usage. With a few start-up parameters for the Node app, the V8 garbage collector can be modified to allow for even more.

    Thanked by 1EdgeWeb
  • raindog308raindog308 Administrator, Veteran

    EdgeWeb said: I'm looking to build a web API that connects to a remote MySQL server, runs a select query, does light manipulation of the result, and delivers it in JSON form over HTTP.

    I need a software stack that is capable of serving 100+ concurrent connections

    Two random thoughts:

    If the web server was on the same server as the MySQL database, those connections would be answered more quickly and overall concurrency would be reduced.

    As of 5.7.8, MySQL can return JSON and has quite a few functions to manipulate it, so if your DBMS version is current enough, you may be able to put more of the work on the DB server, where it's probably executing in highly optimized C as opposed to galaxies of abstraction later in Javascript. If the light manipulation is truly light, a DB stored procedure might be more performant...you'd have to test.

    https://dev.mysql.com/doc/refman/5.7/en/json-functions.html

  • Thank you for confirming my suspicions there @vapornode I'll certainly look into the various parameters for node to see how much I can squeeze out of it.

    @raindog308 My queries are very heavy (joins on millions of rows), so really I was trying to offload from the MySQL server as much as possible, and ideally load balance between multiple servers. However the JSON capabilities of MySQL are very interesting, thanks for bringing those to my attention.

Sign In or Register to comment.