A Java pricing service and a C++ order router each show 8 millisecond pauses about once a minute. Say what you suspect in each, name the log or counter that distinguishes the two causes, and give the fix for each.
A Java pricing service and a C++ order router each show 8 millisecond pauses about once a minute. Say what you suspect in each, name the log or counter that distinguishes the two causes, and give the fix for each.
Approach: For the managed process ask what runs periodically and stops the application threads, and for the native one ask what the kernel does on a first touch or a reclaim.
Suspect a garbage collection pause in the Java service and a major page fault or a huge page compaction stall in the C++ router, and separate them with the collector log showing a stop the world pause of that length against the major faults counter, the perf page-fault event and the compaction counters on the native side. In Java, turn on collector logging with timestamps, size the young generation so promotion is rare, and move to a low pause collector, since 8 milliseconds once a minute is a full young collection on a heap of several gigabytes. In C++ there is no collector, so the pause comes from the kernel: a page reclaim, a first touch of new memory, a transparent huge pages compaction, or a swap-in. Fix it with prefaulting and locking the working set through mlockall plus a warm-up pass, disabling transparent huge pages for that process, and preallocating so nothing grows the heap during trading hours.
Follow-up: How would you prove a pause came from the kernel rather than your own code, on a process you are not allowed to restart?
Key concepts: stop the world pause, major page fault, transparent huge pages, prefaulting.