Avoid Rugged patches with Puma?
Based on discussion on slack.
GitLab has "rugged patches" where we can bypass Gitaly and use Rugged from within the Rails process because in some deployments, this is dramatically faster than using Gitaly.
There is also an ongoing effort to replace Unicorn (Rails web server with one request per process) with Puma (multiple requests per process, using threads).
Because rugged calls do IO and CPU intensive work while holding the Ruby GVL, in theory, I expect poor latency if we would combine Puma and Rugged. Maybe we should do something to avoid that.
[Update] There are too many discussions to read through. For convenience, here is one thread try to summarise some key points(#35371 (comment 259108287)):
Let us re-cap the situation, for single-machine setups:
- We think combine Rugged with Puma(thread>1) will have big performance issue. So far this is more theoretical, we have some testing #35371 (comment 252499607), but it is not enough. -- Do we need to do more performance testing?
- The fact is: turn off rugged will largely degrade performance, thus we want to enable rugged(more comment #35371 (comment 259508557)). We assume this won't change for a while(much later than 13.0). -- So the remaining option are: keep unicorn, or tune puma configuration.
- We do hope to enable Puma by default for everyone(13.0), and deprecate unicorn(maybe 13.x?). Related issue #31765 (comment 243980230) -- Now remaining option is: tune puma configuration
- We assume Puma WmT1 performance is similar to Unicorn Wm. This is backed by Kamil's testing -- so we can change Puma workers/threads to achieve the performance goal.
- We hope this process is smooth(less effort for user, and less support effort for Gitlab). -- So we want to make this process(set optimal Puma workers/threads) automatic.
Now seems the focuses are:
- Action1: for point 1 in above(puma+rugged has visible performance issue when puma thread>1). Should we do more testing to see how much 'puma+rugged' will impact performance?
- Action2: for point 5 in above(automatically set optimal Puma workers/threads). Beside the idea #35371 (comment 258846636), do we have other options? Update: maybe Omnibus upgrade is the most important scenario: #35371 (comment 259649363). And there is an idea to use
rails runner
#35371 (comment 259401498).Question 1: While we are currently focus on Action2, should we put some effort in Action1 as well? Or do we have strong confidence/evidence so we can skip Action1?
Question 2: re-consider the option of
disable Rugged when Puma enabled
, technically this is much clean, but it means we cannot deprecate unicorn, and need very very clear communication. #35371 (comment 259508557), and #35371 (comment 259660055).