plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

Profile REST API calls

Open tisto opened this issue 6 years ago • 4 comments

Being able to profile Plone REST API calls would be handy. Maybe we could create a switch that enables the profiling.

tisto avatar Nov 21 '19 10:11 tisto

@buchi @lukasgraf @vangheem @bloodbare do you have experience with profiling REST calls? Any pointers or recommendations for existing profiling Python libs?

tisto avatar Nov 22 '19 15:11 tisto

We profile the whole python stack.

I love line_profiler as it works really nice for asyncio but otherwise, all the standard python profiling tools. objgraph can be really helpful at times. tracemalloc is good as well.

We also have the ability to turn on request timings by giving the header X-Debug:1:

Screen Shot 2019-11-22 at 10 21 20 AM

We have debug modes(env vars) that will give detailed timings on how long queries take to run.

And we're adding support to be able to debug subscriber timings as well: https://github.com/plone/guillotina/pull/738

Then, we also have different types of ways to load test the stack. We've used locust and have tried some others which names I'm forgetting right now.

Are you looking for different types of profiling though?

vangheem avatar Nov 22 '19 15:11 vangheem

@vangheem nice! I like the idea with the HTTP header to turn on request timings.

We are still on jMeter. I always wanted locust a shot but I know jMeter quite well by now and it has a nice Jenkins integration.

This was exactly the kind of profiling I am after (at least right now).

tisto avatar Nov 22 '19 16:11 tisto

@tisto For our project I implemented profiling using pyinstrument. It is enabled using a cookie rather than a custom HTTP header, because that makes it easier to enable when using volto as a client. The results are sent to the monitoring system rather than returned in the response

davisagli avatar Aug 23 '23 19:08 davisagli