Open flip111 opened 12 months ago
Just FYI. Pursuit-related issues are not my current focus right now. So, I won't be getting to this anytime soon. Also, hdgarrood
is no longer on the core team. Please don't ping him about something for which he no longer has responsibility.
Anyone else with access to the server who could look into this?
I think me and Thomas do, and we're both focused on other things right now.
Yes, I'm not able to focus on Pursuit right now and am not experienced with the code base (I mostly just deploy updates for compilers).
Since you did your investigation we doubled the size of the server and its performance has improved significantly. That said, it's a bandaid for the problems in the code you've identified and it's not an acceptable long term solution.
I'm happy to help shepherd fixes to Pursuit along if you are able to identify cache issues or other performance issues in the code. We can get that code deployed.
Let's see how the new server is doing, perhaps it's enough for the moment. In the mid-near future we want to move to a new purescript codebase anyway
Problem
Since a few weeks, maybe even months i'm see slow results and frequent 502 Bad Gateway not available. I asked on discord and other people also have problems. I think nobody made an issue before because if you just wait a bit and try again then often is ok. Though this issue could be related https://github.com/purescript/pursuit/issues/480
Findings
I downloaded the source code and tested it under load. What i see is this
Investigation & thoughts
This is the only place in the source code i found "index.html" https://github.com/purescript/pursuit/blob/master/src/Handler/Caching.hs#L65-L69
when i look where the functions
cacheHtml
andcacheHtmlConditional
are used i see function names likeWhich i think are all different pages on pursuit.
I don't understand this caching mechanism. Why would you cache to the same file for different pages?
When i let pursuit run in single threaded mode with
+RTS -N1
i still get contention over theindex.html
but far less. I guess yesod still has some form of concurrency going on as time division multiplexing several requests on a single thread.Performance on server
The official pursuit server is also struggling a lot (though it could be underspecced i don't know) @JordanMartinez perhaps you could have a look over a longer time window than 7 days?
Reproduction
To reproduce load testing and profile deeper in time spend per function and memory allocated per function i used the following.
wrk2.dockerfile
profile_memory.sh
For the last two lines you need to install this tool https://github.com/jaspervdj/profiteur (which i recommend). Otherwise remove the the last two lines. When you open the html double click with your mouse on the big color area a lot of times to drill down quickly.
@hdgarrood do you have any idea what is happening here?