cgru icon indicating copy to clipboard operation
cgru copied to clipboard

Solve performance issues

Open sebastianelsner opened this issue 4 months ago • 16 comments

Hello we are running into performance issues where the solve thread on the server is running at 100% and at some point the server is crashing.

I attached perf to the server and found that it is using a lot of its time in "hasTicket", "hasPoolTicket" and "hasHostTickets" calls, as well as a bit less time in regex matching. In the next images you can see the cumulated times used in functions. First read from bottom up, which is the start of the afserver. We are also only looking at the solve thread. The dark blue underlined bars are the time spend in regexes, the light blue bars are the time spend in hasXXXTickets. Especially the ::find(string) calls of the underlying ticket map seem to hit hard.

ksnip_20240228-155340

The next images are inverted, so the long calls are at the bottom. First image hightligts the "hasXXXTicket", the second image hightlights the hostmask regexes.

ksnip_20240228-155347

ksnip_20240228-155346

The broader a bar is at the bottom the longer the function took cumulatively. You can see map::find() takes quite some time cumulatively

How can we speed up the hasTicket queries? Can we do something about how afserver is compiled? Can we switch out the implementation to something faster (I think unordered_map is faster in access). Do you have any other ideas? Parallelize some things?

Regards

Sebastian

sebastianelsner avatar Feb 28 '24 15:02 sebastianelsner