Question

I am running a Finatra server (https://github.com/capotej/finatra) which a sinatra inspired web framework for scala built on top of Finagle (an asynchronous RPC system). The application should be design to receive something between 10 and 50 requests concurrently. Each request is quite CPU intensive, mostly due to parsing and serializing large JSON's and operation on arrays, like sorting, grouping, etc...

Now I am wondering what is the impact of the following parameters on performance and how to combine them :

  • RAM of the server
  • Number of cores of the server
  • JVM heap size
  • Number of threads run on parallel in my Future Pool

As a partial response, I would say :

  • JVM heapsize should me tuned depending on RAM
  • Having multiple cores improves performance under concurrent workload but does not really speed up processing of a single request.
  • Having large RAM, on the contrary, can notably speed up execution of a single request
  • Number of threads in my Future Pool must be tuned according to my number of cores.

EDIT

I want to compare performance regardless of the the code, only focusing on hardware/threading model. Let's assume the code is already optimized. Additional information :

  • I am building a data reporting API. Processing time of a request largely depends of the dataset I am manipulating. For big datasets, it can hit 10 seconds max.
  • I retrieve most of the data from third party API but I am also accessing a MySQL database with a c3po connection pooling mechanism. Execution of the request is additionally delegated to a Future Pool to prevent blocking.
  • No disk IO excluding MySQL
  • I don't want to cache anything on the server side because I need to work with fresh data.

Thanks !!!

Was it helpful?

Solution

The performance and overall behaviour will still depend on your own code, outside of the framework you are using. In other words, you have correctly listed the major factors which will influence performance, but your own code will have such a significant impact on it that it's almost impossible to tell in advance.

Offhand, I'd say that you need to characterize some things about your application in more detail:

  • You say that each request will be CPU intensive, but what do you mean by it? Will each request take 1 ms? 10 ms? 100 ms?
  • Do you access a database? What are the characteristics of your database?
  • Either with the database or without it, do you have any disk IO? How significant is it?

... but if your application is really simple, does not hit the disk much (or at all.. your request may be read-only and everything gets cached), and you are CPU-bound, simply sticking enough CPU cores in your server will be the most significant thing you can do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top