mirror of https://github.com/apache/cassandra
add settings for buffer sizes; make unconfigurable ones more sane.
patch by jbellis; reviewed by Jun Rao and Eric Evans for CASSANDRA-355 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@803135 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9f570c192d
commit
7ea2c96852
|
|
@ -198,6 +198,12 @@
|
|||
<!-- Memory, Disk, and Performance -->
|
||||
<!--======================================================================-->
|
||||
|
||||
<!-- Buffer size to use when performing contiguous column slices.
|
||||
Increase this to the size of the column slices you typically
|
||||
perform. (Name-based queries are performed with a buffer size
|
||||
of ColumnIndexSizeInKB.) -->
|
||||
<SlicedBufferSizeInKB>64</SlicedBufferSizeInKB>
|
||||
|
||||
<!-- Buffer size to use when flushing memtables to disk.
|
||||
(Only one memtable is ever flushed at a time.)
|
||||
Increase (decrease) the index buffer size relative to the data buffer
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public class DatabaseDescriptor
|
|||
|
||||
private static double flushDataBufferSizeInMB_ = 32;
|
||||
private static double flushIndexBufferSizeInMB_ = 8;
|
||||
private static int slicedReadBufferSizeInKB_ = 64;
|
||||
private static List<String> tables_ = new ArrayList<String>();
|
||||
private static Set<String> applicationColumnFamilies_ = new HashSet<String>();
|
||||
|
||||
|
|
@ -239,6 +240,12 @@ public class DatabaseDescriptor
|
|||
flushIndexBufferSizeInMB_ = Double.parseDouble(rawFlushIndex);
|
||||
}
|
||||
|
||||
String rawSlicedBuffer = xmlUtils.getNodeValue("/Storage/SlicedBufferSizeInKB");
|
||||
if (rawSlicedBuffer != null)
|
||||
{
|
||||
slicedReadBufferSizeInKB_ = Integer.parseInt(rawSlicedBuffer);
|
||||
}
|
||||
|
||||
/* TCP port on which the storage system listens */
|
||||
String port = xmlUtils.getNodeValue("/Storage/StoragePort");
|
||||
if ( port != null )
|
||||
|
|
@ -956,4 +963,14 @@ public class DatabaseDescriptor
|
|||
{
|
||||
return flushIndexBufferSizeInMB_;
|
||||
}
|
||||
|
||||
public static int getIndexedReadBufferSizeInKB()
|
||||
{
|
||||
return columnIndexSizeInKB_;
|
||||
}
|
||||
|
||||
public static int getSlicedReadBufferSizeInKB()
|
||||
{
|
||||
return slicedReadBufferSizeInKB_;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,8 @@ public class CommitLog
|
|||
|
||||
for (File file : clogs)
|
||||
{
|
||||
BufferedRandomAccessFile reader = new BufferedRandomAccessFile(file.getAbsolutePath(), "r");
|
||||
int bufferSize = (int)Math.min(file.length(), 32 * 1024 * 1024);
|
||||
BufferedRandomAccessFile reader = new BufferedRandomAccessFile(file.getAbsolutePath(), "r", bufferSize);
|
||||
CommitLogHeader clHeader = readCommitLogHeader(reader);
|
||||
/* seek to the lowest position */
|
||||
int lowPos = CommitLogHeader.getLowestPosition(clHeader);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class SSTableNamesIterator extends SimpleAbstractColumnIterator
|
|||
if (position < 0)
|
||||
return;
|
||||
|
||||
BufferedRandomAccessFile file = new BufferedRandomAccessFile(filename, "r");
|
||||
BufferedRandomAccessFile file = new BufferedRandomAccessFile(filename, "r", DatabaseDescriptor.getIndexedReadBufferSizeInKB() * 1024);
|
||||
try
|
||||
{
|
||||
file.seek(position);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.apache.cassandra.db.IColumn;
|
|||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.io.*;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
|
||||
/**
|
||||
|
|
@ -86,7 +87,7 @@ class SSTableSliceIterator extends AbstractIterator<IColumn> implements ColumnIt
|
|||
|
||||
public ColumnGroupReader(String filename, String key, long position) throws IOException
|
||||
{
|
||||
this.file = new BufferedRandomAccessFile(filename, "r");
|
||||
this.file = new BufferedRandomAccessFile(filename, "r", DatabaseDescriptor.getSlicedReadBufferSizeInKB() * 1024);
|
||||
|
||||
file.seek(position);
|
||||
String keyInDisk = file.readUTF();
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@
|
|||
package org.apache.cassandra.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.cassandra.db.IColumn;
|
||||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
|
|
@ -40,7 +42,11 @@ public class FileStruct implements Comparable<FileStruct>, Iterator<String>
|
|||
|
||||
FileStruct(SSTableReader sstable) throws IOException
|
||||
{
|
||||
this.file = new BufferedRandomAccessFile(sstable.getFilename(), "r", 1024 * 1024);
|
||||
// TODO this is used for both compactions and key ranges. the buffer sizes we want
|
||||
// to use for these ops are very different. here we are leaning towards the key-range
|
||||
// use case since that is more common. What we really want is to split those
|
||||
// two uses of this class up.
|
||||
this.file = new BufferedRandomAccessFile(sstable.getFilename(), "r", 256 * 1024);
|
||||
this.sstable = sstable;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue