Skip to content
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

gsoc2023: net: http: performance analysis #59567

Open
Tracked by #58901
Emna-Rekik opened this issue Jun 21, 2023 · 0 comments
Open
Tracked by #58901

gsoc2023: net: http: performance analysis #59567

Emna-Rekik opened this issue Jun 21, 2023 · 0 comments
Assignees
Labels
GSoC Google Summer of Code Meta A collection of features, enhancements or bugs

Comments

@Emna-Rekik
Copy link

Emna-Rekik commented 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 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 :

CPU Usage Profiling

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:

sudo perf script | ~/FlameGraph/stackcollapse-perf.pl > out.perf-folded

And, then, generate the Flame Graph:

~/FlameGraph/flamegraph.pl out.perf-folded > flamegraph.svg

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 :

Non_asyn_http2_server

Flame graph after handling a HTTP/2.0 request for asynchronous server :

Asyn_http2_server

@Emna-Rekik Emna-Rekik added the Enhancement Changes/Updates/Additions to existing features label Jun 21, 2023
@cfriedt 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 cfriedt changed the title net: http: performance analysis gsoc2023: net: http: performance analysis Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Google Summer of Code Meta A collection of features, enhancements or bugs
Projects
None yet
Development

No branches or pull requests

2 participants