Skip to content

emka.web.id

menulis pengetahuan – merekam peradaban

Menu
  • Home
  • Tutorial
  • Search
Menu

How to benchmarking Apache Tomcat with ab (Apache Bench)

Posted on August 14, 2013

Typically when you want to measure tomcat performance, you will set up the client on a separate machine so that when you are doing testing the client resource usage does not impact the test.

Measuring with Apache Bench

The Apache Bench will probably be installed by default on the Ubuntu server.  What this tool does is to allow you to select one URL and test against that single URL.  In the test that you see below ab was told to retrieve the web URL 100,000 times with a concurrency maximum of 149, since the max is 150 by default with tomcat.

The max threads are listed in the /usr/share/tomcat7/conf/server.xml file as seen here.

[sourcecode]
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
[/sourcecode]

An important point to make here is that you want to perform enough requests to get an accurate view of performance.  Most bench marks will be best with over 100,000 requests.  The “-k” causes ab to use keep-alive connections which is more efficient but maybe not representative of your situation so try both ways to get a understanding of the differences.

ab -k -n 100000 -c 149 http://192.168.5.44:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.5.44 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests

Server Software:        Apache-Coyote/1.1
Server Hostname:        192.168.5.44
Server Port:            8080

Document Path:          /
Document Length:        11850 bytes

Concurrency Level:      149
Time taken for tests:   101.501 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      1207100000 bytes
HTML transferred:       1185000000 bytes
Requests per second:    985.21 [#/sec] (mean)
Time per request:       151.237 [ms] (mean)
Time per request:       1.015 [ms] (mean, across all concurrent requests)
Transfer rate:          11613.74 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0   61 204.1     47    3151
Processing:     3   90 158.2     64    2509
Waiting:        0   65 158.9     40    2476
Total:          4  150 259.0    119    4306

Percentage of the requests served within a certain time (ms)
50%    119
66%    121
75%    122
80%    122
90%    134
95%    189
98%    611
99%   1388
100%   4306 (longest request)

Once the test is complete take a look at the use of tcp_max_tw_buckets as you will certainly see how long it take to break down the tcp connections to your server.

tcp6      86      0 192.168.5.44:8080 192.168.5.44:34064 CLOSE_WAIT
tcp6       0      0 192.168.5.44:8080 192.168.5.44:33955 CLOSE_WAIT
tcp6      86      0 192.168.5.44:8080 192.168.5.44:34027 CLOSE_WAIT
tcp6       1      0 192.168.5.44:8080 192.168.5.44:33912 CLOSE_WAIT
tcp6      86      0 192.168.5.44:8080 192.168.5.44:34025 CLOSE_WAIT
tcp6       1      0 192.168.5.44:8080 192.168.5.44:39259 CLOSE_WAIT
tcp6      86      0 192.168.5.44:8080 192.168.5.44:34063 CLOSE_WAIT
tcp6      86      0 192.168.5.44:8080 192.168.5.44:34082 CLOSE_WAIT
tcp6       1      0 192.168.5.44:8080 192.168.5.44:33849 CLOSE_WAIT
tcp6      86      0 192.168.5.44:8080 192.168.5.44:34062 CLOSE_WAIT
—cut—

Once a test has been performed you may want to increase the tcp_max_tw_buckets setting.  First, list the current settings with:

cat /proc/sys/net/ipv4/tcp_max_tw_buckets
65536
echo 2000000 > /proc/sys/net/ipv4/tcp_max_tw_buckets

ab -k -n 100000 -c 149 http://192.168.5.44:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.5.44 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests

Server Software:        Apache-Coyote/1.1
Server Hostname:        192.168.5.44
Server Port:            8080

Document Path:          /
Document Length:        11850 bytes

Concurrency Level:      149
Time taken for tests:   99.644 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      1207100000 bytes
HTML transferred:       1185000000 bytes
Requests per second:    1003.57 [#/sec] (mean)
Time per request:       148.470 [ms] (mean)
Time per request:       0.996 [ms] (mean, across all concurrent requests)
Transfer rate:          11830.18 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0   61 199.5     47    3100
Processing:     4   87 157.1     63    7623
Waiting:        1   64 155.7     40    7595
Total:          8  148 251.6    118    7630

Percentage of the requests served within a certain time (ms)
50%    118
66%    120
75%    121
80%    122
90%    145
95%    185
98%    440
99%   1408
100%   7630 (longest request)

Here is an example of the result with no “-k” keep-alive connections. What you can see is a dramatic difference in time and as a result it reached the timeout and quit.

ab -n 100000 -c 149 http://192.168.5.44:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.5.44 (be patient)
Completed 10000 requests
Completed 20000 requests
apr_poll: The timeout specified has expired (70007)
Total of 28621 requests completed

via BeginLinux

Terbaru

  • Apa itu Jabatan Panitera Muda Mahkamah Agung, Berapa Gaji & Tunjangannya 2026?
  • Inilah Kenapa Bisa Ada Sensasi Mencekam di Bangunan Tua
  • Apa itu Pengertian Frontier Market di Dunia Saham?
  • Apa itu Krnl Executor Roblox Mei 2026?
  • Inilah Cara Entry Nilai Rapor SPMBJ Jatim 2026 dan Berkas yang Dipersiapkan
  • Inilah 15 SMA Swasta Terbaik di Semarang Menurut Hasil SNBP 2026
  • Inilah Rekomendasi Motor Matic Paling Nyaman Buat Jarak Jauh 2026
  • Ini Jadwal dan Itinerary Liburan Long Weekend Tebing Breksi Yogyakarta
  • Game James Bond 007 First Light Siap Diluncurkan
  • Ini Cara Cek WhatsApp Di Hack atau Tidak + Tips Biar Lebih Aman
  • Daftar Harga HP Vivo Mei 2026, Ini Yang Paling Murah
  • Inilah Lenovo Legion Y70 2026 Bawa Snapdragon 8 Gen 5 dan Baterai Monster, Kapan Rilis?
  • Rekomendasi Lima HP Murah 2 Jutaan dengan RAM 12 GB
  • Hasil Penelitian: Boneka Melatih Kecerdasan Emosional Anak
  • SALAH! MIT Ungkap AI Tidak Ganti Karyawan Karena Efisiensi
  • Inilah Inovasi Terbaru Profesor UI: Pelumas Mobil dari Minyak Nabati!
  • Daftar Sekarang! Beasiswa S2 di Italia dari IYT Scholarship 2026 Sudah Dibuka
  • Sejarah Hantavirus dan Perkembangannya Sampai ke Indonesia
  • Kementerian Pendidikan: Mapel Bahasa Inggris Wajib di SD Mulai 2027!
  • Ketua Fraksi PKB MPR-RI: Kemenag Respon Cepat Pendidikan Santri Ndolo Kusumo Pati yang Terdampak
  • Viral Video Sejoli Di Balai Kota Panggul Trenggalek, Satpol PP Janji Usut
  • Video Viral Wakil Wali Kota Batam Tegur Keras Pasir Ilegal
  • LPDP Buka Peluang Beasiswa S3 Prancis 2026, Simak Syaratnya!
  • Inilah Panduan Lengkap dan Aturan Main Seleksi Penerimaan Murid Baru (SPMB) SMA dan SMK Negeri Jawa Tengah Tahun 2026
  • Inilah Syarat dan Cara Daftar MOFA Taiwan Fellowship 2027
  • RESMI! Inilah Macam Jalur di SPMB Sekolah Tahun Ajaran 2026
  • Ini Loh Rute Terbaru TransJOGJA Per Mei 2026, Jangan Salah Naik!
  • Inilah Jadwal Operasional MRT Jakarta Per Mei 2026, Berubah Dimana?
  • Inilah Syarat dan Mekanisme Seleksi Siswa Unggul ITB Jalur Talenta (OSN, Seniman, Hafidz, Atlet dll) 2026/2027
  • Inilah Daftar Saham Farmasi di BEI Per Mei 2026, Pilih Mana?
  • How to build a high-performance private photo cloud with Immich and TrueNAS SCALE
  • How to Build an Endgame Local AI Agent Setup Using an 8-Node NVIDIA Cluster with 1TB Memory
  • How to Master Windows Event Logs to Level Up Your Cybersecurity Investigations and SOC Career
  • How to Build Ultra-Resilient Databases with Amazon Aurora Global Database and RDS Proxy for Maximum Uptime and Performance
  • How to Build Real-Time Personalization Systems Using AWS Agentic AI to Make Every User Feel Special
  • How to Automate Your Entire SEO Strategy Using a Swarm of 100 Free AI Agents Working in Parallel
  • How to create professional presentations easily using NotebookLM’s AI power for school projects and beyond
  • How to Master SEO Automation with Google Gemini 3.1 Flash-Lite in Google AI Studio
  • How to create viral AI video ads and complete brand assets using the Claude and Higgsfield MCP integration
  • How to Transform Your Mac Into a Supercharged AI Assistant with Perplexity Personal Computer
  • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
  • Apa Itu Predator Spyware? Ini Pengertian dan Kontroversi Penghapusan Sanksinya
  • Mengenal Apa itu TONESHELL: Backdoor Berbahaya dari Kelompok Mustang Panda
  • Siapa itu Kelompok Hacker Silver Fox?
  • Apa itu CVE-2025-52691 SmarterMail? Celah Keamanan Paling Berbahaya Tahun 2025

©2026 emka.web.id | Design: Newspaperly WordPress Theme