summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2012-04-14 09:25:21 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2012-04-14 09:25:21 +0800
commit9514428da9581cac3a31f1068b91557fed51abdd (patch)
tree0e551d1ec16a91c16c85db43883167b423d6c0fb
parentcf296662ce4982a3b46f05026e874ad7e6aa9fd1 (diff)
downloadpttbbs-9514428da9581cac3a31f1068b91557fed51abdd.tar
pttbbs-9514428da9581cac3a31f1068b91557fed51abdd.tar.gz
pttbbs-9514428da9581cac3a31f1068b91557fed51abdd.tar.bz2
pttbbs-9514428da9581cac3a31f1068b91557fed51abdd.tar.lz
pttbbs-9514428da9581cac3a31f1068b91557fed51abdd.tar.xz
pttbbs-9514428da9581cac3a31f1068b91557fed51abdd.tar.zst
pttbbs-9514428da9581cac3a31f1068b91557fed51abdd.zip
Tuning brcstored param
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5637 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rwxr-xr-xpttbbs/daemon/brcstored/brcstored.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pttbbs/daemon/brcstored/brcstored.py b/pttbbs/daemon/brcstored/brcstored.py
index fd4d3bc2..bc9b6e67 100755
--- a/pttbbs/daemon/brcstored/brcstored.py
+++ b/pttbbs/daemon/brcstored/brcstored.py
@@ -35,7 +35,10 @@ def put_data(uid, blob):
def open_database(db_path):
global g_db
- g_db = leveldb.LevelDB(db_path)
+ # BRCv3 max size = 49152 (8192*3*2), so let's increase block size.
+ # LevelDB default I/O buffer size: R=8M, W=2M.
+ g_db = leveldb.LevelDB(db_path, block_size=49152,
+ write_buffer_size=(8 * (2<< 20)))
def handle_request(sock, fd):
@@ -61,6 +64,8 @@ def handle_request(sock, fd):
msg = fd.read(msglen)
logging.info('Write: %s: size=%d', uid, len(msg))
put_data(uid, msg)
+ elif not command:
+ raise ValueError('Incomplete request (no command).')
else:
raise ValueError('Unknown request: 0x%02X' % ord(command))
except:
@@ -74,8 +79,9 @@ def handle_request(sock, fd):
def main(myname, argv):
- level = logging.DEBUG
+ level = logging.WARNING
# level = logging.INFO
+ # level = logging.DEBUG
logging.basicConfig(level=level, format='%(asctime)-15s %(message)s')
if len(argv) not in [0, 1]:
print "Usage: %s [db_path]" % myname