pmwkaa / ioarena

Embedded storage benchmarking tool
Other
132 stars 24 forks source link

Memory consumption is very high for RocksDB #19

Closed linkensphere201 closed 8 years ago

linkensphere201 commented 8 years ago

Hi, I've conduct a test by ioarena to benchmark rocksdb v4.2.0 & the newer version v4.8.0. It's wired that tests on v4.8.0 will consume much more mem than v4.2. Do you guys have any ideas?

rocksdb 4.8.0: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
129456 root 20 0 3505.3m 3.354g 6.8m R 100.0 21.8 4:58.36 src/ioarena -D rocksdb -B set -n 100000000

rocksdb 4.2.0: 120386 root 20 0 182004 14632 5952 S 31.9 0.1 0:25.87 src/ioarena -D rocksdb -B set -n 100000000 (about 14m)

erthink commented 8 years ago

Hm, seems this is RockDB's issue, rather than ioarena.

pmwkaa commented 8 years ago

I might be wrong, just a thought.

This could be because of background memtable dumps. When LSM memtable reaches some size it is need to be saved on disk and freed. To avoid stalls, this operation is done in background. I think there are some tunes that tells how many memtables can be in-work. Probably decreasing this value, would introduce latency spikes.

linkensphere201 commented 8 years ago

THX:) This could be some new default opts of rocksdb v4.8. I am trying to figure out what the options are set. Thanks again:)

linkensphere201 commented 8 years ago

Hi, I am trying to find out what options diff between v4.2 & v4.8 but nothing is found. When I run rocksdb's db_bench the memory usage is not so large. The version is 4.8, too.

 make db_bench
 ./db_bench --benchmarks=fillrandom --num=100000000
 PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                
 27671 root   20   0  192.8m 128.5m   6.6m S 127.0  0.8   1:05.23 db_bench 

That's quite confusing.

linkensphere201 commented 8 years ago

When I tried to make v4.8's default options the same as v.4.2 by adding these lines at the rocksdb::DB::Open(db_impl.cc) +5446 db_options.OldDefaults(4, 2);
+5447 cf_options.OldDefaults(4, 2);
And run ioarena benchmark, then it segmentfault.

linkensphere201 commented 8 years ago

It seems the issue of linking tcmalloc, after I add it at the BuildRocksdb.cmake

        28 set (ROCKSDB_LIBRARIES "${PROJECT_BINARY_DIR}/db/rocksdb/librocksdb${CMAKE_SHARED_LIBRARY_SUFFIX}" bz2 z snappy tcmalloc)
                                                                                                                           ^^^^^^^^        

the segfault and high memory is gone. By default rocksdb will use tcmalloc, I think it's the reason.

----ioarena's make parameters-----
g++ -Wl,--no-as-needed -shared -Wl,-soname -Wl,librocksdb.so.4.2  -g -W -Wextra -Wall -Wsign-compare -Wshadow -Wno-unused-parameter -I. -I./include -std=c++11  -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX  -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DSNAPPY -DGFLAGS=google -DZLIB -DBZIP2 -DROCKSDB_MALLOC_USABLE_SIZE -march=native   -isystem ./third-party/gtest-1.7.0/fused-src -O2 -fno-omit-frame-pointer -momit-leaf-frame-pointer -DNDEBUG -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -fPIC db/builder.cc db/c.cc db/column_family.cc db/compacted_db_impl.cc db/compaction.cc db/compaction_iterator.cc db/compaction_job.cc db/compaction_picker.cc db/convenience.cc db/db_filesnapshot.cc db/dbformat.cc db/db_impl.cc db/db_impl_debug.cc db/db_impl_readonly.cc db/db_impl_experimental.cc db/db_iter.cc db/experimental.cc db/event_helpers.cc db/file_indexer.cc db/filename.cc db/flush_job.cc db/flush_scheduler.cc db/forward_iterator.cc db/internal_stats.cc db/log_reader.cc db/log_writer.cc db/managed_iterator.cc db/memtable_allocator.cc db/memtable.cc db/memtable_list.cc db/merge_helper.cc db/merge_operator.cc db/repair.cc db/slice.cc db/snapshot_impl.cc db/table_cache.cc db/table_properties_collector.cc db/transaction_log_impl.cc db/version_builder.cc db/version_edit.cc db/version_set.cc db/wal_manager.cc db/write_batch.cc db/write_batch_base.cc db/write_controller.cc db/write_thread.cc memtable/hash_cuckoo_rep.cc memtable/hash_linklist_rep.cc memtable/hash_skiplist_rep.cc port/stack_trace.cc port/port_posix.cc table/adaptive_table_factory.cc table/block_based_filter_block.cc table/block_based_table_builder.cc table/block_based_table_factory.cc table/block_based_table_reader.cc table/block_builder.cc table/block.cc table/block_hash_index.cc table/block_prefix_index.cc table/bloom_block.cc table/cuckoo_table_builder.cc table/cuckoo_table_factory.cc table/cuckoo_table_reader.cc table/flush_block_policy.cc table/format.cc table/full_filter_block.cc table/get_context.cc table/iterator.cc table/merger.cc table/meta_blocks.cc table/sst_file_writer.cc table/plain_table_builder.cc table/plain_table_factory.cc table/plain_table_index.cc table/plain_table_key_coding.cc table/plain_table_reader.cc table/table_properties.cc table/two_level_iterator.cc tools/dump/db_dump_tool.cc util/arena.cc util/auto_roll_logger.cc util/bloom.cc util/build_version.cc util/cache.cc util/coding.cc util/comparator.cc util/compaction_job_stats_impl.cc util/crc32c.cc util/db_info_dumper.cc util/delete_scheduler_impl.cc util/dynamic_bloom.cc util/env.cc util/env_hdfs.cc util/env_posix.cc util/io_posix.cc util/file_util.cc util/file_reader_writer.cc util/filter_policy.cc util/hash.cc util/histogram.cc util/instrumented_mutex.cc util/iostats_context.cc utilities/backupable/backupable_db.cc utilities/convenience/info_log_finder.cc utilities/checkpoint/checkpoint.cc utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc utilities/document/document_db.cc utilities/document/json_document_builder.cc utilities/document/json_document.cc utilities/flashcache/flashcache.cc utilities/geodb/geodb_impl.cc utilities/leveldb_options/leveldb_options.cc utilities/memory/memory_util.cc utilities/merge_operators/put.cc utilities/merge_operators/string_append/stringappend2.cc utilities/merge_operators/string_append/stringappend.cc utilities/merge_operators/uint64add.cc utilities/redis/redis_lists.cc utilities/spatialdb/spatial_db.cc utilities/table_properties_collectors/compact_on_deletion_collector.cc utilities/transactions/optimistic_transaction_impl.cc utilities/transactions/optimistic_transaction_db_impl.cc utilities/transactions/transaction_base.cc utilities/transactions/transaction_db_impl.cc utilities/transactions/transaction_db_mutex_impl.cc utilities/transactions/transaction_lock_mgr.cc utilities/transactions/transaction_impl.cc utilities/transactions/transaction_util.cc utilities/ttl/db_ttl_impl.cc utilities/write_batch_with_index/write_batch_with_index.cc utilities/write_batch_with_index/write_batch_with_index_internal.cc util/event_logger.cc util/log_buffer.cc util/logging.cc util/memenv.cc util/murmurhash.cc util/mutable_cf_options.cc util/options.cc util/options_builder.cc util/options_helper.cc util/options_parser.cc util/options_sanity_check.cc util/perf_context.cc util/perf_level.cc util/rate_limiter.cc util/skiplistrep.cc util/slice.cc util/statistics.cc util/status.cc util/status_message.cc util/string_util.cc util/sync_point.cc util/thread_local.cc util/thread_status_impl.cc util/thread_status_updater.cc util/thread_status_updater_debug.cc util/thread_status_util.cc util/thread_status_util_debug.cc util/vectorrep.cc util/xfunc.cc util/xxhash.cc  tools/ldb_cmd.cc tools/ldb_tool.cc tools/sst_dump_tool.cc  \
         -o librocksdb.so.4.2.0

----the default rocksdb's make parameters----
g++ -Wl,--no-as-needed -shared -Wl,-soname -Wl,librocksdb.so.4.2  -g -W -Wextra -Wall -Wsign-compare -Wshadow -Wno-unused-parameter -I. -I./include -std=c++11  -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX  -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DSNAPPY -DGFLAGS=google -DZLIB -DBZIP2 -DROCKSDB_MALLOC_USABLE_SIZE -march=native   -isystem ./third-party/gtest-1.7.0/fused-src -O2 -fno-omit-frame-pointer -momit-leaf-frame-pointer -DNDEBUG -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -fPIC db/builder.cc db/c.cc db/column_family.cc db/compacted_db_impl.cc db/compaction.cc db/compaction_iterator.cc db/compaction_job.cc db/compaction_picker.cc db/convenience.cc db/db_filesnapshot.cc db/dbformat.cc db/db_impl.cc db/db_impl_debug.cc db/db_impl_readonly.cc db/db_impl_experimental.cc db/db_iter.cc db/experimental.cc db/event_helpers.cc db/file_indexer.cc db/filename.cc db/flush_job.cc db/flush_scheduler.cc db/forward_iterator.cc db/internal_stats.cc db/log_reader.cc db/log_writer.cc db/managed_iterator.cc db/memtable_allocator.cc db/memtable.cc db/memtable_list.cc db/merge_helper.cc db/merge_operator.cc db/repair.cc db/slice.cc db/snapshot_impl.cc db/table_cache.cc db/table_properties_collector.cc db/transaction_log_impl.cc db/version_builder.cc db/version_edit.cc db/version_set.cc db/wal_manager.cc db/write_batch.cc db/write_batch_base.cc db/write_controller.cc db/write_thread.cc memtable/hash_cuckoo_rep.cc memtable/hash_linklist_rep.cc memtable/hash_skiplist_rep.cc port/stack_trace.cc port/port_posix.cc table/adaptive_table_factory.cc table/block_based_filter_block.cc table/block_based_table_builder.cc table/block_based_table_factory.cc table/block_based_table_reader.cc table/block_builder.cc table/block.cc table/block_hash_index.cc table/block_prefix_index.cc table/bloom_block.cc table/cuckoo_table_builder.cc table/cuckoo_table_factory.cc table/cuckoo_table_reader.cc table/flush_block_policy.cc table/format.cc table/full_filter_block.cc table/get_context.cc table/iterator.cc table/merger.cc table/meta_blocks.cc table/sst_file_writer.cc table/plain_table_builder.cc table/plain_table_factory.cc table/plain_table_index.cc table/plain_table_key_coding.cc table/plain_table_reader.cc table/table_properties.cc table/two_level_iterator.cc tools/dump/db_dump_tool.cc util/arena.cc util/auto_roll_logger.cc util/bloom.cc util/build_version.cc util/cache.cc util/coding.cc util/comparator.cc util/compaction_job_stats_impl.cc util/crc32c.cc util/db_info_dumper.cc util/delete_scheduler_impl.cc util/dynamic_bloom.cc util/env.cc util/env_hdfs.cc util/env_posix.cc util/io_posix.cc util/file_util.cc util/file_reader_writer.cc util/filter_policy.cc util/hash.cc util/histogram.cc util/instrumented_mutex.cc util/iostats_context.cc utilities/backupable/backupable_db.cc utilities/convenience/info_log_finder.cc utilities/checkpoint/checkpoint.cc utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc utilities/document/document_db.cc utilities/document/json_document_builder.cc utilities/document/json_document.cc utilities/flashcache/flashcache.cc utilities/geodb/geodb_impl.cc utilities/leveldb_options/leveldb_options.cc utilities/memory/memory_util.cc utilities/merge_operators/put.cc utilities/merge_operators/string_append/stringappend2.cc utilities/merge_operators/string_append/stringappend.cc utilities/merge_operators/uint64add.cc utilities/redis/redis_lists.cc utilities/spatialdb/spatial_db.cc utilities/table_properties_collectors/compact_on_deletion_collector.cc utilities/transactions/optimistic_transaction_impl.cc utilities/transactions/optimistic_transaction_db_impl.cc utilities/transactions/transaction_base.cc utilities/transactions/transaction_db_impl.cc utilities/transactions/transaction_db_mutex_impl.cc utilities/transactions/transaction_lock_mgr.cc utilities/transactions/transaction_impl.cc utilities/transactions/transaction_util.cc utilities/ttl/db_ttl_impl.cc utilities/write_batch_with_index/write_batch_with_index.cc utilities/write_batch_with_index/write_batch_with_index_internal.cc util/event_logger.cc util/log_buffer.cc util/logging.cc util/memenv.cc util/murmurhash.cc util/mutable_cf_options.cc util/options.cc util/options_builder.cc util/options_helper.cc util/options_parser.cc util/options_sanity_check.cc util/perf_context.cc util/perf_level.cc util/rate_limiter.cc util/skiplistrep.cc util/slice.cc util/statistics.cc util/status.cc util/status_message.cc util/string_util.cc util/sync_point.cc util/thread_local.cc util/thread_status_impl.cc util/thread_status_updater.cc util/thread_status_updater_debug.cc util/thread_status_util.cc util/thread_status_util_debug.cc util/vectorrep.cc util/xfunc.cc util/xxhash.cc  tools/ldb_cmd.cc tools/ldb_tool.cc tools/sst_dump_tool.cc  \
         -lpthread -lrt -lsnappy -lgflags -lz -lbz2 -ltcmalloc -o librocksdb.so.4.2.0
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         This part is missing for ioarena's make
pmwkaa commented 8 years ago

Nice, thanks for sharing

linkensphere201 commented 8 years ago

Here is my git-patch. Now it's portable for user's own rocksdb shared lib.

From bd872015cb1f5f3083634b4c9400096310cd3f3f Mon Sep 17 00:00:00 2001
From: Weijian Yang <weijyang@foxmail.com>
Date: Tue, 30 Aug 2016 12:10:57 +0800
Subject: [PATCH] fix the memory issue

---
 CMakeLists.txt           |  3 ++-
 cmake/BuildRocksDB.cmake | 13 ++++++++-----
 src/CMakeLists.txt       |  3 +--
 src/ia.c                 |  2 +-
 src/ia_debug.c           |  2 +-
 src/ia_dummy.c           |  2 +-
 src/ia_kv.c              | 18 +++++++++---------
 src/ia_rocksdb.c         |  4 ++--
 src/ioarena.h            | 26 ++++++++++++++++++++++++--
 9 files changed, 49 insertions(+), 24 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c50f023..384e815 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,9 +8,10 @@ execute_process (COMMAND getconf _NPROCESSORS_ONLN
 math (EXPR MAKE_NJOB "((${NB_PROCESSOR}) + 1) * 3 / 2")
 message (STATUS "")

+set(CMAKE_C_COMPILER g++)
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
     ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra -g")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -std=c++11")
 if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
    set(CMAKE_C_FLAGS "${CMAKE_CXx_FLAGS} -O2")
diff --git a/cmake/BuildRocksDB.cmake b/cmake/BuildRocksDB.cmake
index 15d03b0..f5c890f 100644
--- a/cmake/BuildRocksDB.cmake
+++ b/cmake/BuildRocksDB.cmake
@@ -6,23 +6,26 @@ macro(build_rocksdb)
    if (${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
        add_custom_command(
            OUTPUT ${PROJECT_BINARY_DIR}/db/rocksdb/librocksdb${CMAKE_SHARED_LIBRARY_SUFFIX}
-           COMMAND ${CMAKE_MAKE_PROGRAM} -j ${MAKE_NJOB} ${ROCKSDB_OPTS} -C ${PROJECT_BINARY_DIR}/db/rocksdb shared_lib
-           DEPENDS ${CMAKE_BINARY_DIR}/CMakeCache.txt
+            COMMAND ${CMAKE_MAKE_PROGRAM} -j ${MAKE_NJOB} ${ROCKSDB_OPTS} -C ${PROJECT_BINARY_DIR}/db/rocksdb shared_lib
+            DEPENDS ${CMAKE_BINARY_DIR}/CMakeCache.txt
        )
+        message(STATUS "test1: ${CMAKE_MAKE_PROGRAM} ")
    else()
        add_custom_command(
            OUTPUT ${PROJECT_BINARY_DIR}/db/rocksdb/librocksdb${CMAKE_SHARED_LIBRARY_SUFFIX}
            COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/db/rocksdb
            COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/db/rocksdb ${PROJECT_BINARY_DIR}/db/rocksdb
-           COMMAND ${CMAKE_MAKE_PROGRAM} -j ${MAKE_NJOB} ${ROCKSDB_OPTS} -C ${PROJECT_BINARY_DIR}/db/rocksdb shared_lib
-           DEPENDS ${PROJECT_BINARY_DIR}/CMakeCache.txt
+            COMMAND ${CMAKE_MAKE_PROGRAM} -j ${MAKE_NJOB} ${ROCKSDB_OPTS} -C ${PROJECT_BINARY_DIR}/db/rocksdb shared_lib
+            DEPENDS ${PROJECT_BINARY_DIR}/CMakeCache.txt
        )
+
+    message(STATUS "test2: ${CMAKE_MAKE_PROGRAM} -j ${MAKE_NJOB} ${ROCKSDB_OPTS} -C ${PROJECT_BINARY_DIR}/db/rocksdb shared_lib")
    endif()
    add_custom_target(librocksdb ALL
        DEPENDS ${PROJECT_BINARY_DIR}/db/rocksdb/librocksdb${CMAKE_SHARED_LIBRARY_SUFFIX}
    )
    message(STATUS "Use shipped RocksDB: ${PROJECT_SOURCE_DIR}/db/rocksdb")
-   set (ROCKSDB_LIBRARIES "${PROJECT_BINARY_DIR}/db/rocksdb/librocksdb${CMAKE_SHARED_LIBRARY_SUFFIX}" bz2 z)
+   set (ROCKSDB_LIBRARIES "${PROJECT_BINARY_DIR}/db/rocksdb/librocksdb${CMAKE_SHARED_LIBRARY_SUFFIX}" bz2 z snappy tcmalloc)
    set (ROCKSDB_FOUND 1)
    add_dependencies(build_libs librocksdb)
 endmacro(build_rocksdb)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 185e138..9aced54 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")

 set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
 find_package(Threads REQUIRED)
@@ -21,7 +21,6 @@ if(THREADS_HAVE_PTHREAD_ARG)
    set_property(TARGET ${ia_binary} PROPERTY COMPILE_OPTIONS "-pthread")
    set_property(TARGET ${ia_binary} PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread")
 endif()
-
 include_directories("${PROJECT_SOURCE_DIR}/src")
 include_directories("${PROJECT_BINARY_DIR}/src")

diff --git a/src/ia.c b/src/ia.c
index 2681c82..039d150 100644
--- a/src/ia.c
+++ b/src/ia.c
@@ -98,7 +98,7 @@ static int ia_spread(int count, int *nth, long *rotator, long set, int *key_spac
    for(n = 0; n < count; n++) {
        assert(set != 0);

-       iadoer* doer = calloc(1, sizeof(iadoer));
+       iadoer* doer = (iadoer*)calloc(1, sizeof(iadoer));
        if (!doer)
            return -1;

diff --git a/src/ia_debug.c b/src/ia_debug.c
index 31b62b9..b4058ba 100644
--- a/src/ia_debug.c
+++ b/src/ia_debug.c
@@ -34,7 +34,7 @@ static int ia_debug_close(void)
 static iacontext* ia_debug_thread_new()
 {
    iadriver *drv = ioarena.driver;
-   iacontext* ctx = calloc(1, sizeof(iacontext));
+   iacontext* ctx = (iacontext*)calloc(1, sizeof(iacontext));
    printf("%s.thread_new() = %p\n", drv->name, ctx);
    return ctx;
 }
diff --git a/src/ia_dummy.c b/src/ia_dummy.c
index 541f8e1..556a1c8 100644
--- a/src/ia_dummy.c
+++ b/src/ia_dummy.c
@@ -33,7 +33,7 @@ static int ia_dummy_close(void)

 static iacontext* ia_dummy_thread_new()
 {
-   iacontext* ctx = calloc(1, sizeof(iacontext));
+   iacontext* ctx = (iacontext*)calloc(1, sizeof(iacontext));
    return ctx;
 }

diff --git a/src/ia_kv.c b/src/ia_kv.c
index 9e43fc5..b9f72e9 100644
--- a/src/ia_kv.c
+++ b/src/ia_kv.c
@@ -17,11 +17,11 @@

 #define ALPHABET_CARDINALITY 64 /* 2 + 10 + 26 + 26 */
 static const unsigned char alphabet[ALPHABET_CARDINALITY] =
-   "@"
-   "0123456789"
-   "abcdefghijklmnopqrstuvwxyz"
-   "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-   "_";
+{'@',
+'0','1','2','3','4','5','6','7','8','9',
+'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
+'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
+'_'};

 #define BITMASK(n) (~UINTMAX_C(0) >> (64 - (n)))
 #define ALIGN(n) (((n) + sizeof(uint64_t)-1) & ~(sizeof(uint64_t)-1))
@@ -104,7 +104,7 @@ struct ia_kvgen {
 int ia_kvgen_init(struct ia_kvgen **genptr, unsigned kspace, unsigned ksector, unsigned vsize, unsigned vage)
 {
    size_t pair_size = kvpair_bytes(vsize);
-   struct ia_kvgen *gen = realloc(*genptr, sizeof(struct ia_kvgen) + pair_size);
+   struct ia_kvgen *gen = (struct ia_kvgen *)realloc(*genptr, sizeof(struct ia_kvgen) + pair_size);
    if (!gen)
        return -1;

@@ -165,7 +165,7 @@ int ia_kvpool_init(struct ia_kvpool **poolptr, struct ia_kvgen *gen, int pool_si
        return -1;

    size_t bytes = gen->pair_bytes * pool_size;
-   struct ia_kvpool *pool = realloc(*poolptr, sizeof(struct ia_kvpool) + bytes);
+   struct ia_kvpool *pool = (struct ia_kvpool *)realloc(*poolptr, sizeof(struct ia_kvpool) + bytes);
    if (!pool)
        return -1;

@@ -354,7 +354,7 @@ static char* kv_fill(uint64_t *point, char* dst, unsigned length)
        }
        *dst++ = 0;
    } else {
-       uint64_t *p = (void *) dst;
+       uint64_t *p = reinterpret_cast<uint64_t *>(dst);
        for(;;) {
            *p++ = htole64(*point);
            length -= 8;
@@ -365,7 +365,7 @@ static char* kv_fill(uint64_t *point, char* dst, unsigned length)
                left += left;
            } while (left < 64);
        }
-       dst = (void *) p;
+       dst = reinterpret_cast<char *>(p);
    }

    return dst;
diff --git a/src/ia_rocksdb.c b/src/ia_rocksdb.c
index 00f3654..23f845f 100644
--- a/src/ia_rocksdb.c
+++ b/src/ia_rocksdb.c
@@ -25,7 +25,7 @@ struct iacontext {
 static int ia_rocksdb_open(const char *datadir)
 {
    iadriver *drv = ioarena.driver;
-   drv->priv = malloc(sizeof(iaprivate));
+   drv->priv = (iaprivate*) malloc(sizeof(iaprivate));
    if (drv->priv == NULL)
        return -1;

@@ -117,7 +117,7 @@ void ia_rocksdb_thread_dispose(iacontext *ctx)

 static iacontext* ia_rocksdb_thread_new(void)
 {
-   iacontext* ctx = calloc(1, sizeof(iacontext));
+   iacontext* ctx = (iacontext*)calloc(1, sizeof(iacontext));
    return ctx;
 }

diff --git a/src/ioarena.h b/src/ioarena.h
index 38a3fd2..3a9b07e 100644
--- a/src/ioarena.h
+++ b/src/ioarena.h
@@ -53,6 +53,16 @@ int pthread_barrier_wait(pthread_barrier_t* barrier);

 #endif /* PTHREAD_BARRIER_SERIAL_THREAD */

+#define IA_SET 0
+#define IA_BATCH 1
+#define IA_CRUD 2
+#define IA_DELETE 3
+#define IA_ITERATE 4
+#define IA_GET 5
+#define IA_MAX 6
+typedef int iabenchmark;
+
+/*
 typedef enum {
    IA_SET,
    IA_BATCH,
@@ -62,19 +72,31 @@ typedef enum {
    IA_GET,
    IA_MAX
 } iabenchmark;
-
+*/
+#define IA_SYNC 0
+#define IA_LAZY 1
+#define IA_NOSYNC 2
+typedef int iasyncmode;
+/*
 typedef enum {
    IA_SYNC,
    IA_LAZY,
    IA_NOSYNC
 } iasyncmode;
+*/
+#define IA_WAL_INDEF 0
+#define IA_WAL_ON 1
+#define IA_WAL_OFF 2
+typedef int iawalmode;
+

+/*
 typedef enum {
    IA_WAL_INDEF,
    IA_WAL_ON,
    IA_WAL_OFF
 } iawalmode;
-
+*/
 #include <ia_time.h>
 #include <ia_rusage.h>
 #include <ia_kv.h>
-- 
1.9.1