Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TRoBU-0000K3-Jq for pgsql-performance@postgresql.org; Fri, 26 Oct 2012 17:59:04 +0000 Received: from smtp2.peak6.com ([38.98.137.9]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TRoBR-0000aq-EZ for pgsql-performance@postgresql.org; Fri, 26 Oct 2012 17:59:04 +0000 X-AuditID: 0a02cb20-b7f726d000005255-d5-508acf63ca67 Received: from sswchi5pcas2.peak6.net (sswchi5pcas2.peak6.net [10.100.13.24]) by smtp2.peak6.com (Symantec Messaging Gateway) with SMTP id 53.F1.21077.36FCA805; Fri, 26 Oct 2012 12:58:59 -0500 (CDT) Received: from [10.10.201.64] (10.10.201.64) by sswchi5pcas2.peak6.net (10.100.13.25) with Microsoft SMTP Server (TLS) id 14.2.247.3; Fri, 26 Oct 2012 12:58:58 -0500 Message-ID: <508ACF61.1000602@optionshouse.com> Date: Fri, 26 Oct 2012 12:58:57 -0500 From: Shaun Thomas Reply-To: Organization: Peak6 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: "pgsql-performance@postgresql.org" Subject: PSA: New Kernels and intel_idle cpuidle Driver! Content-Type: text/plain; charset="ISO-8859-1"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.201.64] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsXClcIroZt8vivA4MAcXovrM88xOzB6XNg3 jT2AMaqB0SYxLy+/JLEkVSEltTjZVsm/oCQzP6/YI7+0OFXBJbM4OScxMze1SEkhM8VWyVhJ oSAnMTk1NzWvxFYpsaAgNS9FyY5LAQPYAJVl5imk5iXnp2TmpdsqeQb761pYmFrqGirZxSOD hE6WjLXL/jIVPOWv+Hp3E3sD4xWeLkZODgkBE4lt53cxQthiEhfurWfrYuTiEBI4wShxbscc FghnJaPE8mdt7CBVvAL6Er86+sE6WARUJb59WQFmswnoSkzqX8EGYgsJqEj0nb3BBGLzCwhL 7PvQxAxiiwqESSzfuZkJYo6gxMmZT1hAbBEBT4nZ+7eB2cICFhK/NpwFm8ksYCtxYc51Fghb XmL72znMEPNVJVY0T2SDuFpB4v+Vd0wTGAVnIRk7C0n7LCTtCxiZVzGKF5clJmdkmhUU55YU GOkVpCZmm+nlpZZsYgRFJNNphR2Mm3usDjEKcDAq8fAKFHQGCLEmlhVX5h5ilOBgVhLhLTrW FSDEm5JYWZValB9fVJqTWnyI0QcYHhOZpUST84HJIq8k3tDY1MDU0tTQ1NzU0AiHsJI476Xb bQFCAunAtJGdmlqQWgQzjomDU6qBsYHD4bGYZEvRcpeUJfUHBTn9+t4UbigwOepylGVtt1L7 PMt89TefZLUWFTl151/3b+3Jab1zzSFPUPqXtZnP8SlfHs95aPVmUfajDYb8GZn5k7iutvRK zn6r/fn89izjN+t/Cr9U/n3T3VufveXD4z8na+0MjO8Z9ZRL5z7+qPtlKnPUo0e/lFiKMxIN tZiLihMBDC160PUCAAA= X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201210/317 X-Sequence-Number: 48276 Hey guys, I have a pretty nasty heads-up. If you have hardware using an Intel XEON and a newer Linux kernel, you may be experiencing very high CPU latency. You can check yourself: cat /sys/devices/system/cpu/cpuidle/current_driver If it says intel_idle, the Linux kernel will *aggressively* put your CPU to sleep. We definitely noticed this, and it's pretty darn painful. But it's *more* painful in your asynchronous, standby, or otherwise less busy nodes. Why? As you can imagine, the secondary nodes don't get much activity, so spend most of their time sleeping. Now the CPU has a lot more sleep time, and wake latency while trying to copy data or process new WAL traffic. To fix this, you must actually hint to, or outright disable, the driver by picking your own C-state, probably the one you wanted in the BIOS in the first place. We did this by adding the following options to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub, but your distro may differ. intel_idle.max_cstate=0 processor.max_cstate=0 idle=mwait Then reboot. Here are the benefits we got: * %util difference between backing device and DRBD went down by 30-40% on our replicating nodes. * TCP RTT is almost 10x faster. I'm totally not kidding about that last one. Due to the time necessary to wake a CPU to handle the network traffic, latency was massively increased using the intel_idle driver. Our RTT average was 0.375ms on a 10G link before. Now it's 0.04ms after using the settings above. Consider this a PSA. DRBD is unfairly being blamed for bad performance with the intel_idle cpuidle driver in newer kernels! If you have DRBD on a newer Intel system, I highly recommend you make the above changes, especially since it directly affects your replication speed. It took us days to figure this out, so I figured I'd share. Thanks, everyone! -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604 312-444-8534 sthomas@optionshouse.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email