Hi there, I have deployed my Rails app to Rails 7.1.1 and we found that the request time had increased from <100ms to >500ms , we are using ruby 3.2.2 and when we activate the env RUBY_YJIT_ENABLE=true the site site responses increases to over 600ms.
the main entry point is graphql, not sure if that could be the bottleneck here.
I will appreciate any advice, thanks
ok, I’ve downgraded to ruby 3.2.0 , but with the flag YIJIT flag the requests are slower too, this is so weird. I’ve also disabled the YIJIT, and now the app flies again. Some pictures on the system
3.2.2 with YIJIT
In this one, there seems to be some memory leak.
SERVER REQS WITH 3.2.2 & YIJIT
SERVER REQS WITH 3.2.2 & WITHOUT YJIT
This seems to be a little bit better but is over 500ms, not acceptable.
BACK TO 3.2.0
3.2.0 with out YIJIT
SERVER REQS WITH 3.2.0 with out YIJIT
We recommend checking out one of our posts from Shopify about our usage of YJIT with Rails apps Monitoring YJIT in Production | Rails at Scale
In general you’re going to need to experiment with the call threshold to see what works best for your application. One of our engineers after seeing your post recommended trying
--yjit-call-threshold=200 and do the comparison of side-by-side (run a portion of requests on yjit, and a portion on regular ruby) instead of before/after. One of the challenges with before/after is that response times vary time of day and location in the world, increased traffic from social, etc so you’re not getting as accurate data with before/after.