We're looking at CPU bandwidth control via CFS:
Program does number of iterations, in each iteration we burn CPU in small chunks until we get 5ms of real time spent. On each iteration we also print how much
| %0A%20%20query%20IntrospectionQuery%20%7B%0A%20%20%20%20__schema%20%7B%0A%20%20%20%20%20%20queryType%20%7B%20name%20%7D%0A%20%20%20%20%20%20mutationType%20%7B%20name%20%7D%0A%20%20%20%20%20%20subscriptionType%20%7B%20name%20%7D%0A%20%20%20%20%20%20types%20%7B%0A%20%20%20%20%20%20%20%20...FullType%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20directives%20%7B%0A%20%20%20%20%20%20%20%20name%0A%20%20%20%20%20%20%20%20description%0A%20%20%20%20%20%20%20%20locations%0A%20%20%20%20%20%20%20%20args%20%7B%0A%20%20%20%20%20%20%20%20%20%20...InputValue%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%0A%20%20fragment%20FullType%20on%20__Type%20%7B%0A%20%20%20%20kind%0A%20%20%20%20name%0A%20%20%20%20description%0A%20%20%20%20fields(includeDeprecated%3A%20true)%20%7B%0A%20%20%20%20%20%20name%0A%20%20%20%20%20%20description%0A%20%20%20%20%20%20args%20%7B%0A%20%20%20%20%20%20%20%20...InputValue%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20type%20%7B%0A%20%20%20%20%20%20%20%20...TypeRef%0A |
| // gcc -g -shared $(php-config --includes) -L$(php-config --prefix)/lib -lphp7 -o reopcode.so -fPIC reopcode.c | |
| // sudo ./inject -p $(pgrep -n php) reopcode.so | |
| #include <php.h> | |
| #include <zend_API.h> | |
| #include <zend_vm.h> | |
| extern ZEND_API void (*zend_execute_ex)(zend_execute_data *execute_data); | |
| static void (*orig_execute_ex)(zend_execute_data *execute_data); |
We're looking at CPU bandwidth control via CFS:
Program does number of iterations, in each iteration we burn CPU in small chunks until we get 5ms of real time spent. On each iteration we also print how much
| diff --git a/server/config.c b/server/config.c | |
| index 7c7a1e0033..754152b86b 100644 | |
| --- a/server/config.c | |
| +++ b/server/config.c | |
| @@ -45,37 +45,42 @@ | |
| #include "http_protocol.h" | |
| #include "http_core.h" | |
| #include "http_log.h" /* for errors in parse_htaccess */ | |
| #include "http_request.h" /* for default_handler (see invoke_handler) */ | |
| #include "http_main.h" |
| { | |
| <insert_a_suppression_name_here> | |
| Memcheck:Leak | |
| fun:malloc | |
| fun:init_op_array | |
| fun:compile_file | |
| obj:* | |
| ... | |
| fun:zend_execute_scripts | |
| fun:php_execute_script |
| #!/usr/bin/python | |
| # @lint-avoid-python-3-compatibility-imports | |
| # | |
| # cpuunclaimed Sample CPU run queues and calculate unclaimed idle CPU. | |
| # For Linux, uses BCC, eBPF. | |
| # | |
| # This samples the length of the run queues and determine when there are idle | |
| # CPUs, yet queued threads waiting their turn. Report the amount of idle | |
| # (yet unclaimed by waiting threads) CPU as a system-wide percentage. | |
| # |
| #!/usr/bin/python | |
| # | |
| # chaintest Summarize off-CPU time by kernel stack + 2 waker stacks | |
| # WORK IN PROGRESS. For Linux, uses BCC, eBPF. | |
| # | |
| # USAGE: chaintest [-h] [-u] [-p PID] [-i INTERVAL] [-T] [duration] | |
| # | |
| # PLEASE DO NOT RUN THIS IN PRODUCTION! This is a work in progress, intended to | |
| # explore chain graphs on Linux, using eBPF capabilities from a particular | |
| # kernel version (4.3ish). This tool will eventually get much better. |
| # Updated for Ruby 2.3 | |
| string_t = None | |
| def get_rstring(addr): | |
| s = addr.cast(string_t.pointer()) | |
| if s['basic']['flags'] & (1 << 13): | |
| return s['as']['heap']['ptr'].string() | |
| else: | |
| return s['as']['ary'].string() |
ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats
| wget -r -nd -np --spider http://URL_GOES_HERE 2>&1 | perl -ne '$size += $1 if $_ =~ m/^Length: (\d+)/; END{print $size . "\n";}' |