-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache slows down for large responses #40
Comments
Hi @duprasa, 27mb is a serious amount of data! I guess you use Redis as a cache store (am I right?), so it might take some extra time for a network roundtrip. I wonder if it's possible to find out how much time is spent in parser and how long it takes to fetch a cached data (I guess we could compare how much time it takes to execute |
Hi @DmitryTsepelev thanks for the quick reply! Ya it's a ton of data, we are planning on breaking it up into smaller requests, but I found that it illustrated this issue well. I'm just using the default caching mechanism and running it locally, looking at the rails logs I can see that most of the processing is done in view_runtime, so the network isn't adding much overhead. Smaller requests are blazing fast tho and range in the 10-100ms range 👍 I'm not great at rails so I have trouble diagnosing where the issue is exactly, do you think it might be because after cache.fetch, the data needs to be parsed to json (for graphql)? Maybe we can use a faster json parsing libary, I've heard that the deafult one is pretty slow? Thanks again! |
Yeah, you could try writing a custom cache storage using a faster serialiser (example is is here, you need to implement only |
I'm closing the issue for now, feel free to reopen it or open a new one if you have questions 🙂 |
Hi, Amazing gem, really useful and I love the api :D
I'm working on an api that sometimes returns massive amounts of data up to 27mB and the cached responses are a bit slow.
I'm guessing this has to do with parsing the cached data text to a hash/json. Do you think it's possible to speed this up at all?
the response time seems linearly correlated with response size
Thanks for the help!
The text was updated successfully, but these errors were encountered: