Reputation: 2585
There are two Java processes (A, B) on a Linux machine (CentOS 6.5 64bit). A sends lots of binary data to B using sockets. B writes data to disk. Per second 50-100MB data are written to disk. On a quad core processor, the CPU is nearly 100% used. Previously we ran a similar application but written by C, only 25% of CPU was used.
We had done a lot of tuning. We learned that there were some bugs of epoll, then we upgraded JDK version to 1.8. We also did some JVM tuning. Now the total CPU usage is lower than before, but we are not satisfied. We think we can reduce it more.
There are lots of data written to disk. We believe that the disk is not the bottleneck. Because we use a large RAID. We ran the similar application written by C with much more disk bandwidth before, and everything was OK.
But we also find a problem. When the kernel is flushing dirty data to disks, the CPU usage will be very high. So we increase /proc/sys/vm/dirty_background_ratio in order to do asynchronous flushing as much as possible. After we change the value, it seems to work, but after a while, then the high CPU problem comes again.
Can we do more performance tuning for Java applications with high IO bandwidth?
Upvotes: 4
Views: 2759
Reputation: 43125
Before you can do performance tuning you need to find out what's dominating the CPU time.
This is a multi-faceted topic, you'll have to look at what the kernel is doing, which system calls are issued at what rate, what are your access patterns, how do file systems and other storage layers affect the characteristics of various file system operations etc.
Netflix recently presented a way to get full kernel/userspace/java stacks, that might be a useful starting point, but there are many other things to monitor.
Upvotes: 1