You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testing the performance of an HTTP server involves measuring its handling of various loads.
CPU Usage Profiling
We can use perf to collect statistics about the CPU usage of our server with the stat command.
$ sudo perf stat -p <pid_of_server>
perf stat will then start monitoring our server. We can let it run while sending requests to our server. Once we've collected enough data, we can stop perf stat which will print a summary of the performance statistics.
These are the statistics for CPU usage obtained after running our server under a load of 100 requests with a concurrency level of 10 using ApacheBench tool :
Hotspot Analysis
perf record and perf report can be used together to identify the functions in our code that consume the most CPU time.
$ sudo perf record -g -p <pid_of_server> -o perf.data
After running our server under load (For example, using ApacheBench tool), we can stop the recording and analyze the data using:
sudo perf report -i perf.data
After generating a file named perf.data which contains the profiling data, we can visualize it using FlameGraph tool. It's particularly useful for identifying the most expensive code-paths and inspect where our application is spending the most time.
To do this, we need to convert the perf.data to a format that FlameGraph can understand:
We are continuously working to enhance the design and performance of our server. One of the major modifications involves making our server more asynchronous, which is expected to save significant resources.
We will analyze the impact of this improvement by comparing CPU profiling data that we generated using perf, and we will visualize it using a Flame Graph.
Flame graph after handling a HTTP/2.0 request for non asynchronous server :
Flame graph after handling a HTTP/2.0 request for asynchronous server :
The text was updated successfully, but these errors were encountered:
cfriedt
added
Meta
A collection of features, enhancements or bugs
GSoC
Google Summer of Code
and removed
Enhancement
Changes/Updates/Additions to existing features
labels
Jun 21, 2023
cfriedt
changed the title
net: http: performance analysis
gsoc2023: net: http: performance analysis
Jun 21, 2023
Performance Analysis
Testing the performance of an HTTP server involves measuring its handling of various loads.
CPU Usage Profiling
We can use
perf
to collect statistics about the CPU usage of our server with thestat
command.perf stat
will then start monitoring our server. We can let it run while sending requests to our server. Once we've collected enough data, we can stopperf stat
which will print a summary of the performance statistics.These are the statistics for CPU usage obtained after running our server under a load of 100 requests with a concurrency level of 10 using ApacheBench tool :
Hotspot Analysis
perf record
andperf report
can be used together to identify the functions in our code that consume the most CPU time.After running our server under load (For example, using ApacheBench tool), we can stop the recording and analyze the data using:
After generating a file named
perf.data
which contains the profiling data, we can visualize it usingFlameGraph
tool. It's particularly useful for identifying the most expensive code-paths and inspect where our application is spending the most time.To do this, we need to convert the
perf.data
to a format that FlameGraph can understand:And, then, generate the Flame Graph:
We can view flamegraph.svg using a web browser.
We are continuously working to enhance the design and performance of our server. One of the major modifications involves making our server more asynchronous, which is expected to save significant resources.
We will analyze the impact of this improvement by comparing CPU profiling data that we generated using perf, and we will visualize it using a Flame Graph.
Flame graph after handling a HTTP/2.0 request for non asynchronous server :
Flame graph after handling a HTTP/2.0 request for asynchronous server :
The text was updated successfully, but these errors were encountered: