What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safest way to optimize Tomcat on Ubuntu is to measure the bottleneck first, then change one class of settings at a time. Track request throughput, p95 and p99 latency, error rate, CPU, heap occupancy, garbage-collection pauses, active and queued requests, connection counts, and database or API saturation. Tune JVM memory, the HTTP connector, and systemd placement only when those measurements show a constraint; otherwise, larger thread pools and heaps can simply move the bottleneck or trigger out-of-memory failures.

This guide targets the Ubuntu tomcat10 package, while calling out where a tarball installation or another Tomcat release differs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Measure the workload before changing Tomcat

Optimization has a target. Decide whether you need lower tail latency, more requests per second, fewer errors, faster startup, or lower resource use. Capture a baseline during representative traffic, including normal load and the busiest period you can reproduce.

Record application and JVM signals

  • Throughput: requests per second at the same success criteria.
  • Latency: median, p95, and p99 rather than an average alone.
  • Errors: HTTP 4xx and 5xx rates, timeouts, rejected connections, and application exceptions.
  • CPU: process and host utilization, with attention to sustained saturation.
  • Memory: heap occupancy after garbage collection, committed heap, metaspace, native memory, and process resident memory.
  • Garbage collection: pause duration, frequency, and whether the live set keeps growing.
  • Concurrency: active request-processing threads, queued requests, open connections, and keep-alive connections.
  • Dependencies: database pool usage, query latency, downstream API latency, and signs that a dependency is already at capacity.

Keep the baseline beside the configuration used to produce it. A change is an improvement only if it raises the target metric without causing unacceptable CPU, GC, error, or dependency pressure.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Change one class of settings

Change JVM memory, connector concurrency, connection behavior, and host-level placement in separate experiments. Restart when required, run the same smoke test, and compare the same traffic shape. Retain a copy of the service environment and XML files so that a bad result can be reversed immediately.

2. Confirm the Ubuntu package and service layout

Ubuntu’s Noble tomcat10 package normally uses a systemd unit at /usr/lib/systemd/system/tomcat10.service, policy and configuration files under /etc/tomcat10, and runtime directories under /var/lib/tomcat10. The package layout includes conf, logs, and work directories there. A Tomcat archive unpacked under /opt/tomcat has a different layout and startup mechanism, so do not apply package paths to it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the installed unit

dpkg -l tomcat10
tomcat10 --version
systemctl status tomcat10
systemctl cat tomcat10
systemctl show tomcat10 --property=User,Group,Environment,ExecStart
journalctl -u tomcat10 --no-pager

These commands establish the installed version, service account, startup command, environment, and log locations. The unit file may reference an environment file or package-specific startup script; use the paths shown on your host rather than assuming a filename.

Keep privileges and ownership separate

Run Tomcat as its dedicated service user, not as root. The Apache Tomcat 10.1 setup guidance states: “For optimal security, the service should be run as a separate user, with reduced permissions.” Verify ownership before changing files:

systemctl show tomcat10 --property=User,Group
namei -l /etc/tomcat10 /var/lib/tomcat10

Grant the service account only the read, write, and bind permissions the application requires. Do not expose the shutdown port, management applications, or administrative endpoints to untrusted networks.

3. Put JVM memory limits in CATALINA_OPTS

Tomcat’s current RUNNING.txt documentation explicitly separates startup options from runtime options: “Do not use JAVA_OPTS to specify memory limits. You do not need much memory for a small process that is used to stop Tomcat. Those settings belong to CATALINA_OPTS.” Use CATALINA_OPTS for -Xms, -Xmx, garbage-collector flags, and other options needed by the running server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set the option through the package’s systemd mechanism

First inspect systemctl cat tomcat10 to learn whether the package reads an environment file. If you need a local override, create a drop-in rather than editing the vendor unit:

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
sudo systemctl edit tomcat10

Add a service environment assignment that preserves any options already required by the unit. For a simple installation, the drop-in can contain:

[Service]
Environment="CATALINA_OPTS=-Xms1024m -Xmx2048m"

Use values derived from measurement, not this example. If the unit already defines CATALINA_OPTS, combine the required flags instead of accidentally replacing package defaults. Apply and verify the change:

sudo systemctl daemon-reload
sudo systemctl restart tomcat10
systemctl show tomcat10 --property=Environment
ps -eo pid,args | grep '[j]ava'

JVM tools such as jcmd can confirm the effective flags for the running process:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
jcmd <PID> VM.flags
jcmd <PID> GC.heap_info

Choose heap size from the live set and available memory

Observe heap occupancy after full or old-generation collections under representative load. Leave room for metaspace, thread stacks, direct and native buffers, the JVM itself, monitoring agents, file cache, and the operating system. In a VM or container, use the actual memory limit, not the host’s total RAM. A heap that consumes nearly all available memory can be killed by the operating system even when Java has not reported an ordinary heap exhaustion.

-Xms controls the initial heap and -Xmx the maximum heap. A larger initial heap can reduce expansion work but reserves memory earlier. A larger maximum can delay heap exhaustion only when the host has enough headroom and the live set is genuinely larger; it cannot fix a leak or an overloaded downstream service. Change one value at a time, then compare post-GC occupancy, pause time, process RSS, and error rate.

Recognize memory failure patterns

  • Java heap out-of-memory: inspect retained objects, request sizes, caches, and heap occupancy before raising -Xmx.
  • Long GC pauses with low throughput: check allocation rate and live-set size; adding threads or heap without reducing allocation can worsen pauses.
  • Container or host kill: compare process RSS and native usage with the cgroup or VM limit; heap flags account for only part of total memory.
  • Many blocked requests and growing thread stacks: concurrency may be too high even if heap usage looks acceptable.

4. Tune the HTTP connector and executor

Tomcat’s connector reference defines how request-processing threads, connection queues, timeouts, keep-alive behavior, compression, and NIO polling interact. Treat documented defaults as starting points, not performance targets.

Know the documented defaults and examples

Setting Documented value Meaning
maxThreads 200 default in the Tomcat 8.5/10-era connector reference Maximum simultaneous request-processing threads when the connector owns the pool
minSpareThreads 10 default Threads kept available for incoming work
NIO pollerThreadCount One per processor, capped at two Poller threads used by the NIO connector
connectionTimeout 20,000 ms in the current sample connector Example time before an incomplete connection is timed out
Shared executor maxThreads 150 in the current sample Example maximum for a shared executor
Shared executor minSpareThreads 4 in the current sample Example minimum spare threads

The exact installed Tomcat version controls which attributes are valid. Confirm the version and read its configuration reference before copying an attribute from another major release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Understand connector threads versus an Executor

maxThreads limits concurrent request processing. If the connector uses an associated Executor, the executor’s thread-pool settings take precedence over connector-level pool attributes. Check server.xml for an executor element before changing maxThreads; otherwise you may edit a value that has no effect.

Increase concurrency only when requests are waiting on I/O and the database or API can absorb additional simultaneous work. If CPU is already saturated, more threads generally increase context switching and contention. If active threads are low but requests queue behind a slow dependency, fix or protect that dependency rather than enlarging the pool indefinitely.

Use acceptCount for short bursts, not chronic overload

acceptCount controls the queue used when all request-processing threads are busy. Raise it only when measurements show brief connection bursts and the operating-system listen backlog is configured to support the larger queue. A large queue during sustained overload increases waiting time and can make p99 latency worse; it does not increase the server’s processing capacity.

Align timeouts and keep-alive with the proxy

The connector’s connectionTimeout and keep-alive behavior must be compatible with the reverse proxy or load balancer in front of Tomcat. If the proxy closes idle connections first, clients may see resets; if Tomcat keeps them much longer, the server can hold unnecessary sockets. Compare proxy idle, request, and upstream timeouts with Tomcat’s values and test slow clients explicitly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use compression selectively

Compression can reduce bandwidth for text responses, but it consumes CPU. Enable it only after measuring response sizes, CPU, and latency, and restrict it to content types where the reduction is worthwhile. Do not compress already-compressed images, archives, or media merely because a connector example enables compression.

Retain sensible NIO socket behavior

The connector reference documents tcpNoDelay as true by default and notes that it generally improves performance. Change it only for a measured reason. NIO poller counts are normally derived from processor availability; manually constraining them can reduce capacity on a busy host.

Example connector and executor structure

The following illustrates where the settings live; it is not a universal target configuration. Adapt attributes to the exact Tomcat version and workload:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
<Executor name="tomcatThreadPool"
          namePrefix="catalina-exec-"
          maxThreads="150"
          minSpareThreads="4" />

<Connector port="8080"
           protocol="org.apache.coyote.http11.Http11NioProtocol"
           executor="tomcatThreadPool"
           connectionTimeout="20000"
           redirectPort="8443" />

Validate XML before restarting, keep a copy of the previous file, and watch the same latency, error, queue, CPU, and dependency metrics after deployment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Keep XML and options version-aware

Tomcat 10.1.60’s configuration reference describes schemaless, case-sensitive XML and property substitution from JVM and other supported property sources. A typo in an element or attribute can prevent startup or silently leave a setting unused. Check the installed version before adding options copied from a different Tomcat generation.

Use the package configuration under /etc/tomcat10 and the active configuration path shown by the unit. Do not edit generated or vendor-owned files when a systemd drop-in or package-supported environment mechanism can express the change.

TLS and HTTP/2

The sample server.xml includes optional TLS and HTTP/2 connectors. Terminate TLS at a trusted reverse proxy when that matches your architecture, or configure Tomcat’s TLS connector deliberately with current certificates and protocol settings. Whichever design you choose, restrict management endpoints and the shutdown port to trusted administrative networks.

6. Apply security updates as part of performance work

Ubuntu security notice USN-8417-1, published 10 June 2026, lists multiple Tomcat issues, including request-body memory exhaustion and HTTP/2 handling problems, and provides fixed package versions. Update the Ubuntu packages and restart Tomcat after applying the fixes:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt update
sudo apt install --only-upgrade tomcat10
sudo systemctl restart tomcat10
systemctl status tomcat10

Record the Tomcat and Java versions before and after the update. Run a smoke test and compare the same latency, error, heap, and CPU metrics; security fixes can change behavior and resource use.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

7. Consider CPU and NUMA placement only after profiling

Ubuntu systemd supports persistent controls such as CPUAffinity=, NUMAPolicy=, and NUMAMask=. They can help specialized, latency-sensitive deployments, but a narrower CPU set can reduce total capacity and a restrictive NUMA policy can increase remote-memory costs.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Use a drop-in only after profiling scheduler behavior and memory locality:

sudo systemctl edit tomcat10
[Service]
# Add CPUAffinity=, NUMAPolicy=, or NUMAMask= only from measured evidence

After changing placement, compare tail latency, throughput, CPU utilization, GC pauses, and downstream saturation against the unpinned baseline.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

8. Compare candidate configurations scientifically

Use the same application build, Java version, traffic mix, database state, proxy settings, and test duration for each candidate. Keep a small change log containing the old value, new value, reason, restart time, and rollback command.

Decision metric What an improvement looks like Warning sign
p95 and p99 latency Lower tail latency at the same traffic and error rate Average improves while p99 or timeout rate worsens
Throughput More successful requests per second without saturating dependencies More requests are accepted but database or API latency rises sharply
CPU Headroom remains at the target throughput Additional threads push sustained CPU saturation
Heap and GC Stable post-GC occupancy and bounded pauses Heap grows toward the limit or pauses lengthen
Concurrency Active and queued requests match expected service time Queues grow continuously or connections remain idle but numerous
Operating system Memory, file descriptors, and listen backlog remain healthy Connection failures, swapping, or cgroup kills appear

9. Troubleshoot common symptoms

Requests queue while CPU is low

Check active threads, executor limits, database-pool usage, and downstream latency. If threads are blocked on I/O and dependencies have capacity, raise the effective executor limit in a small step. If the database pool is already full, increasing Tomcat threads only creates more waiting work.

CPU is saturated after increasing maxThreads

Revert the thread increase, then profile hot code, serialization, compression, and database usage. A larger pool cannot make CPU-bound requests complete faster and may increase contention.

Latency rises during connection bursts

Check acceptCount, the operating-system listen backlog, proxy connection reuse, and whether the burst is brief or sustained. Increase the queue only for short bursts; for sustained load, add capacity or reduce request cost.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Tomcat exits after a memory change

Read journalctl -u tomcat10, the JVM error log, and host or cgroup events. Reduce -Xmx if native memory or the operating-system limit is being exhausted, and investigate leaks or oversized caches before trying a still larger heap.

Clients see resets or idle timeouts

Compare Tomcat’s connection and keep-alive settings with every proxy and load-balancer timeout. Align the shortest idle and request limits deliberately, then test long-lived and slow connections.

10. Roll back cleanly

  1. Stop traffic or drain the instance if your deployment supports graceful draining.
  2. Restore the previous server.xml, environment file, or systemd drop-in from the versioned copy.
  3. Run sudo systemctl daemon-reload when a unit drop-in changed.
  4. Restart with sudo systemctl restart tomcat10.
  5. Check systemctl status tomcat10, journalctl -u tomcat10, the Java command line, and a smoke-test request.
  6. Compare errors, latency, heap, GC, CPU, queues, and connections with the baseline before restoring full traffic.

Practical optimization checklist

  • Identify the actual Ubuntu package, Tomcat version, service user, configuration path, and log path.
  • Capture latency percentiles, throughput, errors, CPU, heap, GC, queues, connections, and dependency saturation.
  • Back up the service environment and XML files.
  • Put runtime memory flags in CATALINA_OPTS, not JAVA_OPTS.
  • Size -Xms and -Xmx from observed live-set behavior and total memory limits.
  • Determine whether a shared Executor overrides connector thread settings.
  • Increase concurrency only when I/O waits and downstream capacity justify it.
  • Align connection timeouts and keep-alive with the proxy or load balancer.
  • Measure compression before enabling it broadly.
  • Verify XML attributes against the installed Tomcat release.
  • Apply Ubuntu security updates and repeat the same smoke and performance tests.
  • Use CPU or NUMA affinity only after profiling demonstrates a benefit.

There is no universal percentage speed-up or ideal thread count for every Ubuntu Tomcat deployment. The winning configuration is the one that improves your chosen latency or throughput target while keeping CPU, memory, garbage collection, queues, errors, and downstream systems within safe limits.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.