BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx

上传人:b****5 文档编号:18697630 上传时间:2022-12-31 格式:DOCX 页数:18 大小:314.40KB
下载 相关 举报
BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx_第1页
第1页 / 共18页
BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx_第2页
第2页 / 共18页
BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx_第3页
第3页 / 共18页
BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx_第4页
第4页 / 共18页
BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx

《BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx(18页珍藏版)》请在冰豆网上搜索。

BerkeleyDB和eXtremeDB性能在LINUX下的比较Word格式文档下载.docx

numitems=0;

FILE 

*fp;

char 

*progname;

voidop_ds(u_int,int);

voidop_ds_bulk(u_int,u_int*);

voidop_tds(u_int,int,u_int32_t);

voidres(char*,u_int);

void

res(char*msg,u_intops)

{

doubleelapsed;

structdb_timev;

v.secs=end_time.secs-start_time.secs;

v.usecs=end_time.usecs-start_time.usecs;

if(start_time.usecs>

end_time.usecs){

v.secs--;

v.usecs+=1000000;

}

elapsed=v.secs+v.usecs/1e6;

printf("

%s\n\telapsedtime:

%fseconds:

%gkey/datapairspersec\n"

msg,elapsed,ops/elapsed);

op_ds(u_intops,intupdate)

char*letters="

abcdefghijklmnopqrstuvwxuz"

;

DB*dbp;

DBTkey,data;

char*keybuf,*databuf;

DB_MPOOL_STAT 

*gsp;

(void)remove("

a"

);

assert((keybuf=malloc(keysize))!

=NULL);

assert((databuf=malloc(datasize))!

memset(&

key,0,sizeof(key));

data,0,sizeof(data));

key.data=keybuf;

key.size=keysize;

memset(keybuf,'

a'

keysize);

data.data=databuf;

data.size=datasize;

memset(databuf,'

b'

datasize);

assert(db_create(&

dbp,NULL,0)==0);

dbp->

set_errfile(dbp,stderr);

assert(dbp->

set_pagesize(dbp,pagesize)==0);

open(dbp,NULL,NULL,NULL,DB_BTREE,DB_CREATE,0666)==0);

dbenv->

memp_stat(dbp->

dbenv,&

gsp,NULL,DB_STAT_CLEAR);

if(update){ 

__os_clock(NULL,&

start_time.secs,&

start_time.usecs);

for(;

ops>

0;

--ops){

keybuf[(ops%keysize)]=letters[(ops%26)];

put(dbp,NULL,&

key,&

data,0)==0);

end_time.secs,&

end_time.usecs);

}else{

--ops)

get(dbp,NULL,&

gsp,NULL,0);

assert(gsp->

st_cache_miss==0);

close(dbp,0)==0);

op_ds_bulk(u_intops,u_int*totalp)

DBC*dbc;

u_int32_tlen,klen;

u_inti,total;

void*pointer,*dp,*kp;

assert((databuf=malloc(bulkbufsize))!

set_cachesize(dbp,0,cachesize,1)==0);

for(i=1;

i<

=numitems;

++i){

(void)sprintf(keybuf,"

%10d"

i);

#if0

fp=fopen("

before"

"

w"

dbp->

set_msgfile(dbp,fp);

assert(dbp->

stat_print(dbp,DB_STAT_ALL)==0);

cursor(dbp,NULL,&

dbc,0)==0);

data.ulen=bulkbufsize;

data.flags=DB_DBT_USERMEM;

if(ops>

10000)

ops=10000;

for(total=0;

assert(dbc->

c_get(

dbc,&

data,DB_FIRST|DB_MULTIPLE_KEY)==0);

DB_MULTIPLE_INIT(pointer,&

data);

while(pointer!

=NULL){

DB_MULTIPLE_KEY_NEXT(pointer,&

data,kp,klen,dp,len);

if(kp!

=NULL)

++total;

*totalp=total;

/*assert(dbp->

*/

op_tds(u_intops,intupdate,u_int32_ttxn_flags)

DB_ENV*dbenv;

DB_TXN*txn;

#ifndef_WIN32

(void)system("

rm-rfTESTDIR;

mkdirTESTDIR"

assert(db_env_create(&

dbenv,0)==0);

set_errfile(dbenv,stderr);

assert(dbenv->

set_flags(dbenv,DB_AUTO_COMMIT|txn_flags,1)==0);

set_lg_bsize(dbenv,logbufsize)==0);

open(dbenv,"

TESTDIR"

DB_CREATE|DB_PRIVATE|DB_INIT_LOCK|

DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN,

0666)==0);

dbp,dbenv,0)==0);

open(dbp,NULL,"

NULL,DB_BTREE,DB_CREATE,0666)==0);

if(update){

memp_stat(dbenv,&

--ops){

txn_begin(dbenv,NULL,&

txn,0)==0);

assert(txn->

commit(txn,0)==0);

st_page_out==0);

close(dbenv,0)==0);

int

main(intargc,char*argv[])

externchar*optarg;

externintoptind;

u_intops,total;

intch;

intmajor,minor,patch;

if((progname=strrchr(argv[0],'

/'

))==NULL)

progname=argv[0];

else

++progname;

ops=100000;

while((ch=getopt(argc,argv,"

d:

k:

o:

p:

"

))!

=EOF)

switch(ch){

case'

d'

:

datasize=(u_int)atoi(optarg);

break;

k'

keysize=(u_int)atoi(optarg);

o'

ops=(u_int)atoi(optarg);

p'

pagesize=(u_int32_t)atoi(optarg);

?

'

default:

usage();

argc-=optind;

argv+=optind;

numitems=(cachesize/(keysize+datasize-1))/2;

db_version(&

major,&

minor,&

patch);

UsingBerkeleyDB%d.%d.%d-"

major,minor,patch);

ops:

%u;

keysize:

%d;

datasize:

%d\n"

ops,keysize,datasize);

op_ds(ops,0);

res("

DS(read):

ops);

if(keysize>

=8){

op_ds_bulk(ops,&

total);

res("

DS(bulkread):

total);

\n"

\tskipped:

bulkgetrequiresakeysize>

=10\n"

op_ds(ops,1);

DS(write):

op_tds(ops,0,0);

TDS(read):

op_tds(ops,1,DB_LOG_INMEMORY);

TDS(write,in-memorylogging):

op_tds(ops,1,DB_TXN_NOSYNC);

TDS(write,no-synconcommit):

op_tds(ops,1,DB_TXN_WRITE_NOSYNC);

TDS(write,write-no-synconcommit):

op_tds(ops,1,0);

TDS(write,synconcommit):

return(EXIT_SUCCESS);

usage()

fprintf(stderr,

"

usage:

%s[-ddatasize][-kkeysize][-oops][-ppagesize]\n"

progname);

exit

(1);

2、eXtremeDB测试源程序:

/*****************************************************************

*

*Copyright(c)2001-2006McObjectLLC.AllRightReserved. 

*****************************************************************/

/*ThistestallowstoreceivesomeresultsabouttheeXtremeDBperformance

*forallbasicoperations.ThistestinsertsNobjectsintoaclass,creating

*ahashindexasitdoesinsertions;

thenseparatellybuildsatreeindex,

*performssearchesusingatreeandahashtable,anasequentialsearch.

*Atlastthetreeisremovedandalltheobjectaredeletedone-by-one.

*EachInsetrtionanddeletiondoneinaseparatetransaction,sothe

*committimeisincludedinthemeasurements.

platform.h>

//#include<

mcoHA.h>

perf2.h"

/*Makesureyou'

vegotthis16M,otherwiseyou'

llbemeasuring

*theperformanceofyourdisk.

#defineDBSIZE 

(1024*16000)

#definePAGESIZE 

128

constintMAP_ADDRESS= 

0x20000000;

/*Ifyouchangethenumberofobjectsinserted,makesurethatyou

*firsthaveenoughmemory(DBSIZE),andalsodecalredhashtable

*sizeappropriatelly(hkey[estimated_numeber_of_entries]inperf2.mco

constintnRecords=100000;

void_SH_(void){

chartext[]={

\nThistestallowstoreceivesomeresultsabouttheeXtremeDB\n"

performance

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 医药卫生 > 基础医学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1