Here is my task. Every second backgrounder task should generate json based on some data. This operation is not cpu intensive ( mostly network) and it generates JSON content (5-10KB). Operations take about 200ms.
Also I have about 1000 clients asking for this content once every few seconds. Let's say it's about 200 requests/sec.
Server should just output current actual json.
Currently i already have rails 4+nginx+passenger+debian sever doing other jobs, related to this work.
Being a student I want to make my server in a most cost-effective way having an ability to easy-scale in this ways:
Currently I have linode 2048 ssd with 2 CPU Cores. My questions are:
you mentioned "Server should just output current actual json", I guess the JSON generation may not become a bottleneck as you can cache it to Memcache and serve Memcache directly:
1) Periodically background process -> dump data to Memcache (even gzip to speed it up)
2) User -> Nginx -> Memcache
See the Nginx memcache built in module http://nginx.org/en/docs/http/ngx_http_memcached_module.html
The bottleneck is any backend with blocking mechanism, GIL, IO locks etc, try to avoid these type of problems by split request/response cycle with intermediate Memcache data point.