question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hints on setup (gc and threadpool)

See original GitHub issue

Please answer these questions before submitting your issue.

What version of gRPC are you using?

1.6.1

What did you expect to see?

I’m starting to build another grpc service that’s supposed to handle something like 5k message per second (on commodity hardware) on average.

Messages weigh about 1k.

What’s a good setup when it comes to:

  • gc (we give it up to 8GB using are configuring -XX:+UseG1GC, -XX:ParallelGCThreads=8, -XX:ConcGCThreads=2)
  • thread-pool (we’re now using new NioEventLoopGroup(16)

Is there any recommended setup?

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
carl-mastrangelocommented, Feb 22, 2018

I recommend using fewer threads in your NioEventLoop, and more in your ManagedChannel / Server executor. gRPC is usually less of your work load (i.e. your business logic) so it doesn’t need so many resources. I also recommend setting -Xmx and -Xms to the same value, and as high as you can allow. This makes memory management (from a sysadmin POV) easier. We typically set it to around 8GB in our benchmarks.

A lot of the times getting the system to be fast involves running it and finding the slow parts. Once you know the slow parts, we (gRPC team) can give more specific advice about what to optimize. You can use a Java profiler (like FlightRecorder, YourKit, JProfiler, etc. to get this information, so that you can see where to optimize next.

0reactions
carl-mastrangelocommented, Mar 6, 2018

If the application logic you are doing is non blocking, you can try using the directExecutor() on your ServerBuilder which will avoid the wakeup. Otherwise, this behavior is expected. Youll need to do much more work in order to get the batching benefits. Right now, if the work level is too low, the server will be constantly waking up the Nio thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Garbage Collection with ThreadPool - Stack Overflow
My thinking is the anonymous function in MyWorkClass.DoSomething() will be stored in the local variable declaration space of MyWorkerClass. This ...
Read more >
Debug ThreadPool Starvation - Microsoft Learn
A tutorial that walks you through debugging and fixing a ThreadPool starvation issue on .NET Core.
Read more >
Thread Pool Monitoring - Software AG Documentation
In the thread pool configuration, check whether you have allocated enough threads. · Check for overall system slowdown, such as disk speed, ...
Read more >
Finding Ideal JVM Thread Pool Size With Kubernetes and ...
In this post, I explain why we use JVM thread pools, what are the parameters that we should take into account when we...
Read more >
Thread pools | Elasticsearch Guide [master] | Elastic
The number of processors is automatically detected, and the thread pool settings are automatically set based on it. In some cases it can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found