0

I am trying to create this service which makes async http calls. For this I am using gevent with a set of greenlets defined in a pool.

The users will make a request to this service which will be put in a queue. Now the greenlets in the pool will read from the queue, make corresponding http calls to fetch data related to the request. I am wondering how many greenlets should I spawn. I am not sure whats the cost of each greenlet?

How do I define the number of greenlets?

rajan sthapit
  • 4,194
  • 10
  • 42
  • 66
  • The footprint of a greenlet is small compared toba thread. How many you should spawn is a question of your code, your latencies and your calling profile. – Klaus D. Aug 01 '18 at 05:17
  • @KlausD. Could you please quantify small? Lets say they just make http calls to www.google.com in each greenlet. Is 200 a decent number? I mean lets say the latency, other factors are fine. I just want to make sure that if I spawn 200 greenlets that itself won't cause much issue. – rajan sthapit Aug 01 '18 at 05:28
  • Well, you will have to find the best value yourself by testing. Remember that there is not just the happy path and failures have a large impact on the performance. – Klaus D. Aug 01 '18 at 05:36

0 Answers0