plone / plone.restapi

RESTful API for Plone.
http://plonerestapi.readthedocs.org/
84 stars 73 forks source link

Profile REST API calls #835

Open tisto opened 4 years ago

tisto commented 4 years ago

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

tisto commented 4 years ago

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

vangheem commented 4 years ago

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?

tisto commented 4 years ago

@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).

davisagli commented 10 months ago

@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