0

I am running apache benchmark (ab) with server [httpd2.4.52] running locally. I want to track how many memory allocations and what size allocations does the server make. I run 'valgrind --trace-malloc=yes ab -n 10 http://127.0.0.1/' But the number of allocations is ~4.6k regardless of the number of requests (I tried 10,100,1000).

  1. Is this because Apache uses its own custom memory allocator?
  2. How can I track the allocations (specifically #allocations, total/avg size of allocations) for this custom allocator?
  3. This page mentions an option named ALLOC_USE_MALLOC in apr code, but, I could not find this option in apr source code (I checked versions 1.7.0, 1.4.8, 1.4.2 and httpd2.0.51)
  • Do you need to trace every allocation? Or is just an overview enough. For a more general overview you can use massif (with `--pages-as-heap=yes` if apache is using its own allocator). – Paul Floyd Feb 17 '22 at 10:50
  • Isn't ab a client that sends requests to the server ? If yes, it means that you are then analysing what the ab client does, and not what the http server does ? Also, in case multiple processes are used, you might want to use the --trace-children option of valgrind. – phd Feb 17 '22 at 17:45
  • @PaulFloyd Ideally i'd like to trace every allocation.... – Aditi Partap Mar 06 '22 at 03:35
  • @phd thanks for pointing this out! But, I am not sure how to run valgrind with apache2 since it runs in the background, I tried running 'valgrind --trace-malloc=yes --trace-children=yes /usr/local/apache2/bin/apachectl -k start -DFOREGROUND' , but it just exits in a few seconds. – Aditi Partap Mar 06 '22 at 03:36
  • @AditiPartap Is the same command working without valgrind ? If yes, try to activate some tracing of apachectl and see what differs between a native run and the run under valgrind. – phd Mar 13 '22 at 16:58
  • Actually, the command "valgrind --trace-malloc=yes --trace-children=yes /usr/local/apache2/bin/apachectl -k start -D FOREGROUND" is working now. But, I am now seeing ~11k allocations for both 1000, 10k requests (which I make by running 'ab -n 1000 http://127.0.0.1/' in a separate terminal). – Aditi Partap Mar 14 '22 at 17:43

0 Answers0