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

  • Belum Tahu Cara Masuk Simpatika Terbaru? Ini Cara Login PTK EMIS GTK IMP 2026 Supaya Cek TPG Jadi Lebih Gampang!
  • Inilah Cara Bikin Konten Animasi AI Cuma Modal HP Supaya Bisa Gajian Rutin dari YouTube
  • Inilah Alasan Kenapa Zakat ke Ormas yang Belum Diakui Negara Nggak Bisa Dipakai Buat Ngurangin Pajak!
  • Inilah Cara Belanja di Indomaret Pakai Shopee PayLater yang Praktis dan Bikin Hemat!
  • Inilah 10 Jurusan Terfavorit di Universitas Negeri Semarang Buat SNBT 2026, Saingannya Ketat Banget!
  • Belum Tahu? Inilah Cara Mudah Membuat Akun dan Login EMIS GTK IMP 2026 yang Benar!
  • Cara Dapat Kode Kartu Hadiah Netflix Gratis Tanpa Ribet
  • Inilah Caranya Dapet Bukti Setor Zakat Resmi dari NU-Care LazisNU Buat Potong Pajak di Coretax!
  • Inilah 10 Jurusan Terfavorit di Universitas Brawijaya Buat SNBT 2026, Saingannya Ketat Banget!
  • Inilah Cara Terbaru Login dan Ubah Password Akun PTK di EMIS GTK IMP 2026
  • Inilah Batas Maksimal Zakat untuk Pengurang Pajak, Ternyata Begini Aturannya!
  • Inilah Cara Mengenali Aplikasi Bodong Penghasil Uang Agar Kalian Nggak Jadi Korban Penipuan Digital
  • Apa itu Error Kode LADK3 saat Buka Rekening Brimo? Dan Solusinya!
  • BOHONG??? Inilah Rincian Anggaran Makan Bergizi Gratis, Ternyata Uang Bahan Makanannya Nggak Sampai Rp15.000!
  • Inilah Tugas Proktor Ujian TKA SD/SMP 2026, Baca Dulu Ada Yang Beda!
  • Tips Pajak Coretax: Inilah Cara Memastikan Lembaga Amil Zakat yang Sah Agar Pajak Kalian Berkurang!
  • Kenapa FreeFire Advance Server Tidak Bisa Diunduh? Ini Penjelasannya!
  • Inilah Realita Biaya Hidup Mahasiswa di Bogor: Ternyata Nggak Semahal yang Kalian Kira!
  • Inilah Cara Blokir Email Spam di Gmail Biar Penyimpanan Nggak Gampang Penuh
  • Inilah Cara Aktivasi Keaktifan PTK di EMIS GTK IMP 2026 Biar Tunjangan Cair Lancar!
  • Inilah Cara Menilai Sumbangan yang Disetarakan dengan Uang Supaya Pajak Kalian Berkurang
  • Apa itu Pin di iMessage?
  • SKTP Nggak Muncul di Info GTK padahal Sudah Terbit? Ini Trik Rahasia Biar Data Langsung Update!
  • Ini Trik Nuyul Cari Cuan di Game Puzzle Farm 2026 Biar Koin Melimpah Tanpa Undang Teman
  • Inilah Ukuran Kertas Thermal 58mm ISO Di Word, Berapa dan Panduan Lengkap Memilihnya
  • Bukan Cuma Zakat! Ternyata Sumbangan Jenis Ini Bisa Ngurangin Pajak Kalian! Simak Penjelasannya
  • Inilah Caranya Mengajar Bahasa Indonesia di Amerika Serikat Lewat Beasiswa Fulbright FLTA 2026
  • Inilah 6 Rekomendasi HP yang Awet dan Tahan Lama Biar Kalian Nggak Gonta-ganti Terus!
  • Apa itu Proses BOP dan Psikotes BRI Life?
  • Ini Cara Input Tugas Tambahan Guru di EMIS GTK IMP 2026 Biar Jam Mengajar Aman!
  •  How to Fix Windows 11 ISO Download Blocked and Error Messages
  • How to Make Your Website Vibrate with Web Haptics
  • Measuring LLM Bullshit Benchmark
  • A Step-by-Step Guide to ZITADEL Identity Infrastructure
  • How NVIDIA G-SYNC Pulsar is Finally Fixing Motion Blur Forever
  • The Secret Reason Seedance 2.0 is Realistic
  • Exploring Microsoft Phi-4 Reasoning Vision 15B
  • Gemini 3.1 Flash-Lite Released: How to Master Google’s Fastest AI Model for Real-World Projects
  • Qwen Is Ruined! Why the Masterminds Behind Qwen 3.5 Left Alibaba Cloud
  • GPT-5.3 Instant Revealed: How the New OpenAI Update Changes Everything for AI Users
  • 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
Beli Morning Star Kursi Gaming/Kantor disini: https://s.shopee.co.id/805iTUOPRV
Beli Pemotong Rumput dengan Baterai IRONHOOF 588V Mesin Potong Rumput 88V disini https://s.shopee.co.id/70DBGTHtuJ

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