Replies: 1 comment 1 reply
-
this doesn't work out in general, I've found. If I use tasks in CachedHttpRepository I have the issue that that doesn't stream responses - it downloads first then sends. So, I'm experimenting with using nginx as a caching layer, and just using HttpRepository to stream. But if I use that, some of the clients that use the task above end up getting dropped connection errors - I guess it's not going to like trying to read from an already exhausted stream. However, the biggest benefit of using the task was to avoid repeated requests for the very slow main project index anyway; so I just changed my SkippingRepository to do this:
... and that gets rid of the thundering herd. |
Beta Was this translation helpful? Give feedback.
-
Running some tests I noticed that we often had many concurrent requests in flight for the same url; they were hitting CachedHttpRepository while the original request was still in flight so never hit the cache.
This isn't ideal; eventually I did this (which may not be the best idea either, but it works)
... renaming the original _fetch_simple_page to _fetch_simple_page_task. It doesn't really matter here if I remove items from the queue with the same task or same page url, or if there are multiple items in the queue with the same page_url; that kind of thing may happen in edge cases, the main thing is to not have 50 requests for /simple/ in flight.
It would probably make more sense to handle this by wrapping the session, so it applies to all the outgoing requests, and also throttling the requests that make it into the task behind a semaphore.
Beta Was this translation helpful? Give feedback.
All reactions