Return-Path: Delivered-To: apmail-cassandra-dev-archive@www.apache.org Received: (qmail 90773 invoked from network); 21 Feb 2011 18:23:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Feb 2011 18:23:08 -0000 Received: (qmail 40072 invoked by uid 500); 21 Feb 2011 18:23:07 -0000 Delivered-To: apmail-cassandra-dev-archive@cassandra.apache.org Received: (qmail 39833 invoked by uid 500); 21 Feb 2011 18:23:05 -0000 Mailing-List: contact dev-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list dev@cassandra.apache.org Received: (qmail 39816 invoked by uid 99); 21 Feb 2011 18:23:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Feb 2011 18:23:04 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=FSL_RU_URL,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yngwiie@bk.ru designates 94.100.176.89 as permitted sender) Received: from [94.100.176.89] (HELO smtp12.mail.ru) (94.100.176.89) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Feb 2011 18:22:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=09WsBE8AHq+Nm51uIJCtFoTw9H91A8yK+v4m8vxKSKk=; b=iXOEv7qDI2YiyYluG4uB2mcNE8wZ4w+OJIlEKuuEa7fHl0JDgAssYXhKR/Q7rgKV2mGsOkGO3kPaWxxpqi2IIFUALp0rLCjGt/AkffrRAwijGKykNDv+T9wCk3PUQKib; Received: from [109.160.16.234] (port=12064 helo=[192.168.2.10]) by smtp12.mail.ru with asmtp id 1PraP6-00022Z-00; Mon, 21 Feb 2011 21:22:36 +0300 Message-ID: <4D62AD6A.3030009@bk.ru> Date: Mon, 21 Feb 2011 20:22:34 +0200 From: Ivan Georgiev User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: user@cassandra.apache.org CC: dev@cassandra.apache.org Subject: Re: 0.7.2 slow memtables flushing References: <4D5FD0CB.2040608@bk.ru> <4D5FF0B7.2090308@bk.ru> <4D6088D0.90403@bk.ru> <4D62556A.1020202@bk.ru> In-Reply-To: <4D62556A.1020202@bk.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit X-Spam: Not detected X-Mras: Ok Some more digging. This is the code path causing the excessive rebuffer() calls. java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Unknown Source) at org.apache.cassandra.io.util.BufferedRandomAccessFile.reBuffer(BufferedRandomAccessFile.java:204) at org.apache.cassandra.io.util.BufferedRandomAccessFile.seek(BufferedRandomAccessFile.java:394) at org.apache.cassandra.io.sstable.SSTableWriter.append(SSTableWriter.java:148) at org.apache.cassandra.db.Memtable.writeSortedContents(Memtable.java:159) at org.apache.cassandra.db.Memtable.access$000(Memtable.java:49) at org.apache.cassandra.db.Memtable$1.runMayThrow(Memtable.java:174) at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:30) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Basically the rebuffer() is being called through seek(). In 0.7.0 seek() does not call rebuffer() while 0.7.1 and on does and that is where the performance degradation is happening in my test case. Any ideas how to alleviate the problem ? Ivan On 21.2.2011 �. 14:07 �., Ivan Georgiev wrote: > I did some very rough measurements in a desperate attempt to see if I > can find the issue (if there is an issue). > Since I dont know the code base well enough i chose > BufferedRandomAccessFile as my suspect, since it was rewritten from > 0.7.0 to 0.7.1 > > I did rough measurements on how many times write() and rebuffer() were > called, and how much time was spent in them. The measurements > were printed out when close() on the file was called. Time > measurements are rounded in seconds. I have included the measurements > only for the > large files that were flushed to disk. > > 0.7.0 > Total time in reBuffer : 0 seconds. > Total times called reBuffer : 2 > Total time in write : 0 seconds. > Total times called write : 579374 > > 0.7.2 > Time spent in reBuffer : 67 seconds. > Times called reBuffer : 30888 > Time spent in write : 0 seconds. > Times called write : 1884107 > > Seems like rebuffer is being called a lot more in 0.7.2 and thats > where the performance degradation is coming from. > > rebuffer can end up being called from write itself, but since the time > spent in write is insignificant, that means this excessive > calling of rebuffer in 0.7.2 is not happening from the write path. > > Ivan > > > On 20.2.2011 �. 05:21 �., Ivan Georgiev wrote: >> Is it possible that the changes to the BufferedRandomAccessFile.java >> could be causing the issue ? >> I think the most notable change there is using ByteBuffer instead of >> a byte[] for the buffer. >> >> I will run more tests and see what comes out of it. >> >> Ivan >> >> On 20.2.2011 �. 05:03 �., Jonathan Ellis wrote: >>> I guess you'll need to binary search through the 0.7.1 changes to find >>> what made the difference. I can't think of any obvious candidates. >>> >>> On Sat, Feb 19, 2011 at 10:32 AM, Ivan Georgiev wrote: >>>> On 19.2.2011 �. 16:43 �., Jonathan Ellis wrote: >>>>> Flush code didn't change between 0.7.0 and 0.7.2. There must be some >>>>> other variable here. Memory pressure maybe? >>>> Cloud you please elaborate on that one ? >>>> The conditions are exactly the same for the test with 0.7.0 and 0.7.2. >>>> By the way, 0.7.1 tests are similar to 0.7.2, while 0.7 early betas >>>> to 0.7.0 >>>> is fine. >>>> >>>> Ivan >>>> >>>> On 19.2.2011 �. 16:43 �., Jonathan Ellis wrote: >>>>> Flush code didn't change between 0.7.0 and 0.7.2. There must be some >>>>> other variable here. Memory pressure maybe? >>>>> >>>>> On Sat, Feb 19, 2011 at 8:16 AM, Ivan Georgiev >>>>> wrote: >>>>>> Hi, >>>>>> >>>>>> I am testing 0.7.2 on a Windows 2003 x64 system(one node) and I >>>>>> am having >>>>>> the following problem. >>>>>> My insertion speed is relatively slow, so the memtables do not >>>>>> get full >>>>>> and >>>>>> the actual flushing is triggered by memtable_flush_after_mins, this >>>>>> happens >>>>>> on the hour mark. My problem with 0.7.2 is that when that >>>>>> happens, the >>>>>> cpu >>>>>> spikes to 25% overall usage (x4 Xeon) and the operation takes >>>>>> anywhere >>>>>> from >>>>>> 2 to 4 minutes, leaving the node not responding during that time. >>>>>> This >>>>>> has >>>>>> forced to me to increase the rpc timeout option to beyond what i >>>>>> feel >>>>>> comfortable with. >>>>>> I have run multiple tests with 0.7.0 and 0.7.2 with the same >>>>>> dataset and >>>>>> the >>>>>> results are consistent. During the same operation 0.7.0 takes >>>>>> about 10 >>>>>> seconds to complete vs. 2 to 4 minutes for 0.7.2. I am attaching >>>>>> a log >>>>>> with >>>>>> the timestamps from one such flushing of 0.7.2. Please let me >>>>>> know if >>>>>> there >>>>>> is anything i can do to speed up and get results similar to 0.7.0. >>>>>> >>>>>> Regards: >>>>>> Ivan >>>>>> >>>>>> This is the log of the operations which took most time during the >>>>>> flush >>>>>> operation. Using 0.7.0, with the same number of operations the >>>>>> flushing >>>>>> takes less than 10 seconds. >>>>>> >>>>>> INFO 01:36:44,906 Enqueuing flush of >>>>>> Memtable-ArchiveFiles.6f776e65724944@1225856921(1619949 bytes, 34467 >>>>>> operations) >>>>>> INFO 01:37:47,375 Completed flushing >>>>>> C:\Storage\data\Storage\ArchiveFiles.68617368-f-3-Data.db >>>>>> (5549187 bytes) >>>>>> INFO 01:37:47,375 Writing >>>>>> Memtable-ArchiveFiles.6e616d65@978152661(1619949 >>>>>> bytes, 34467 operations) >>>>>> INFO 01:37:47,375 Enqueuing flush of >>>>>> Memtable-ArchiveFiles.706172656e74466f6c6465724944@2097700961(1619949 >>>>>> >>>>>> bytes, >>>>>> 34467 operations) >>>>>> INFO 01:38:51,343 Completed flushing >>>>>> C:\Storage\data\Storage\ArchiveFiles.6e616d65-f-3-Data.db >>>>>> (3820265 bytes) >>>>>> INFO 01:38:51,343 Writing >>>>>> Memtable-ArchiveFiles.6f776e65724944@1225856921(1619949 bytes, 34467 >>>>>> operations) >>>>>> >>>>> >>>> >>> >>> >> >> > >