-
-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instrument python runner to get more metrics around delayed executions #2974
Comments
I don't see execution log we've added in #2718. Have we forgot to expose it on detailed view of st2client? |
@enykeev Yeah, good point - we probably need to update client to include it when -d flag is used :) |
@lakshmi-kannan Done some more measuring and it looks like that bulk of the time (around 1.5 seconds). is indeed spent in I checked eventlet implementation to see what is going on (e.g. if it's using some long poll timeout or similar) and I couldn't find anything offending - https://github.com/eventlet/eventlet/blob/master/eventlet/green/subprocess.py eventlet patches Another thing is also worth nothing (and something we should write in the documentation) is that no one should expect sub-1 second run time for Python runner actions - if users want to use it for something which requires such response times they will need to write their own runner, doing that with a Python runner which involves forking a subprocess with Python interpreter is simply not possible. |
I did some more testing - removing communicate and doing process.wait(); process.stdout.read(), process.stderr.read(). It looks like that the slow part is indeed reading from stdout and stderr pipe (that's what basically communicate does). |
I tried various things including changing the buffer size, etc, and I can't get the run-time to decrease when reading from stdout and stderr. So in short there is not much we do for the Python runner. One thing we should do though is document the performance profile of runners - StackStorm is primarily also designed for longer running actions so if users need sub-second or Lambda like performance StackStorm is not a good fit (they could get a run time down by using a custom runner though). We should make this very explicit in documentation so there won't be any surprises. |
Simple Python actions take a few seconds to complete execution.
It looks like the fork call takes a couple of seconds but I benchmarked the fork call and it doesn't appear that fork is expensive from a standalone tester (https://gist.github.com/lakshmi-kannan/eb03a3f92d72b6f391a2f18fc8211883). So we have to instrument our code to get more fine grained metrics.
The text was updated successfully, but these errors were encountered: