Bug 40054 - ab performance improvements
Summary: ab performance improvements
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: support (show other bugs)
Version: 2.0-HEAD
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2006-07-17 06:57 UTC by Brad Roberts
Modified: 2008-05-27 15:15 UTC (History)
0 users



Attachments
remove unnecessary structure copies (5.08 KB, patch)
2006-07-17 06:57 UTC, Brad Roberts
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Roberts 2006-07-17 06:57:13 UTC
I've been playing with ab on one of sun's t2000's and the slowness of the
individual threads + some inefficiencies in ab combine for some amount of pain.
 One of the obvious sources are unecessary struct copying.  I'll attach a patch
to fix that next.
Comment 1 Brad Roberts 2006-07-17 06:57:52 UTC
Created attachment 18608 [details]
remove unnecessary structure copies
Comment 2 Brad Roberts 2006-07-17 09:58:45 UTC
I re-ran my performance tests tonight, both with 2.0.55 and trunk, both with and
with out compiling with -pg.  I no longer see the performance benefits I saw
when I did those changes.  I'm not sure what's up at the moment.

One simple change that buys 100 tps with -pg is not to completely destroy/create
the pool, just clear it out:

@@ -1129,8 +1129,9 @@
     c->gotheader = 0;
     c->rwrite = 0;
     if (c->ctx)
-        apr_pool_destroy(c->ctx);
-    apr_pool_create(&c->ctx, cntxt);
+        apr_pool_clear(c->ctx);
+    else
+        apr_pool_create(&c->ctx, cntxt);
 
     if ((rv = apr_socket_create(&c->aprsock, destsa->family,

Comment 3 Brad Roberts 2006-07-17 10:11:24 UTC
The biggest time sync's are pollset manipulation:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls   s/call   s/call  name    
 10.72      0.97     0.97   400000     0.00     0.00  apr_pollset_add
  7.29      1.63     0.66        1     0.66     8.77  test
  6.85      2.25     0.62   171963     0.00     0.00  apr_pollset_poll
  6.41      2.83     0.58   100000     0.00     0.00  close_connection
  6.30      3.40     0.57   200000     0.00     0.00  apr_pollset_remove
  6.19      3.96     0.56   600000     0.00     0.00  get_epoll_event
  5.52      4.46     0.50   200000     0.00     0.00  read_connection
  4.53      4.87     0.41   771966     0.00     0.00  apr_time_now
  4.31      5.26     0.39   300000     0.00     0.00  get_epoll_revent
  4.20      5.64     0.38   200000     0.00     0.00  apr_socket_connect
  4.09      6.01     0.37   200000     0.00     0.00  apr_socket_recv
  4.09      6.38     0.37   100003     0.00     0.00  start_connect
  3.54      6.70     0.32   100000     0.00     0.00  write_request
  3.09      6.98     0.28   400040     0.00     0.00  apr_palloc
  2.76      7.23     0.25   200000     0.00     0.00  apr_socket_send
  2.65      7.47     0.24                             __divdi3
  1.99      7.65     0.18   100000     0.00     0.00  alloc_socket
  1.66      7.80     0.15   100000     0.00     0.00  apr_socket_timeout_set
  1.55      7.94     0.14   100000     0.00     0.00  set_socket_vars
  1.44      8.07     0.13   100000     0.00     0.00  apr_socket_create
  1.44      8.20     0.13   100000     0.00     0.00  socket_cleanup
  1.33      8.32     0.12   200001     0.00     0.00  apr_sockaddr_vars_set
  1.22      8.43     0.11   100010     0.00     0.00  apr_pool_cleanup_register
  1.22      8.54     0.11   100001     0.00     0.00  apr_pool_cleanup_kill
  1.10      8.64     0.10   100000     0.00     0.00  sononblock
  1.10      8.74     0.10    99997     0.00     0.00  apr_pool_clear
  0.88      8.82     0.08   100001     0.00     0.00  apr_pool_cleanup_run
  0.88      8.90     0.08   100000     0.00     0.00  apr_socket_opt_set
  0.66      8.96     0.06   100003     0.00     0.00  run_cleanups
  0.55      9.01     0.05   100000     0.00     0.00  apr_socket_close
  0.44      9.05     0.04                             __floatdisf
  0.00      9.05     0.00   100003     0.00     0.00  free_proc_chain
Comment 4 Roy T. Fielding 2008-05-12 14:28:50 UTC
I independently found and fixed the struct issue of your first patch
when I was doing a general overhaul of the stats a few days ago.
The second patch has now been applied as well (r655654).
Comment 5 Ruediger Pluem 2008-05-27 15:15:56 UTC
Backported to 2.2.x as r660576 (http://svn.apache.org/viewvc?rev=660576&view=rev).