O'Reilly logo

Web Performance Tuning, 2nd Edition by Patrick Killelea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Symmetric Multiprocessing (SMP)

Enterprise-level applications often need more CPU power than any single-CPU machine can provide, but getting an application to effectively use multiple CPUs can be tricky. If you are lucky, your application may be able to run on separate single-CPU machines. Web servers scale this way. But many applications, such as databases, need to run on a single machine.

If your application must be run on a single machine, you have to add CPUs to scale it. One strategy for using multiple CPUs in that machine is to run multiple processes and have them communicate via the various forms of interprocess communication, such as semaphores and shared memory. The operating system will automatically allocate different CPUs to different processes. But interprocess communication techniques are not especially portable.

Native thread libraries provide a way to use multiple CPUs in a single process, and can be relatively portable, but native thread programming is difficult. Java thread programming, by comparison, is simple. Not only is Java thread programming simple, but programs using Java threads are extremely portable, and Java threads have been advertised as scaling well on multi-CPU machines. As we’ll see next, this has not been entirely true in recent versions of Java, but there are some simple things you can do to maximize Java multithreading performance on multi-CPU machines.

Getting multiple equivalent CPUs to cooperate in a single machine is known as Symmetric ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required