@@ -298,7 +298,6 @@ async function burstRead() {
298298 const database = newTestDatabase ( {
299299 min : 100 ,
300300 max : 400 ,
301- writes : 0.2 ,
302301 incStep : incStep ,
303302 } ) ;
304303 const pool = database . pool_ as SessionPool ;
@@ -335,7 +334,6 @@ async function burstWrite() {
335334 const database = newTestDatabase ( {
336335 min : 100 ,
337336 max : 400 ,
338- writes : 0.2 ,
339337 incStep : incStep ,
340338 } ) ;
341339 const pool = database . pool_ as SessionPool ;
@@ -352,7 +350,6 @@ async function burstWrite() {
352350 if ( incStep ) {
353351 console . timeEnd ( `burstWrite incStep ${ incStep } ` ) ;
354352 console . log ( `Current session pool size: ${ pool . size } ` ) ;
355- console . log ( `Current num write sessions: ${ pool . writes } ` ) ;
356353 }
357354 } finally {
358355 await database . close ( ) ;
@@ -374,7 +371,6 @@ async function burstReadAndWrite() {
374371 const database = newTestDatabase ( {
375372 min : 100 ,
376373 max : 400 ,
377- writes : 0.2 ,
378374 incStep : incStep ,
379375 } ) ;
380376 const pool = database . pool_ as SessionPool ;
@@ -397,7 +393,6 @@ async function burstReadAndWrite() {
397393 if ( incStep ) {
398394 console . timeEnd ( `burstReadAndWrite incStep ${ incStep } ` ) ;
399395 console . log ( `Current session pool size: ${ pool . size } ` ) ;
400- console . log ( `Current num write sessions: ${ pool . writes } ` ) ;
401396 }
402397 } finally {
403398 await database . close ( ) ;
@@ -416,7 +411,6 @@ async function multipleWriteBursts() {
416411 const database = newTestDatabase ( {
417412 min : 100 ,
418413 max : 400 ,
419- writes : 0.2 ,
420414 incStep : incStep ,
421415 } ) ;
422416 const pool = database . pool_ as SessionPool ;
@@ -436,7 +430,6 @@ async function multipleWriteBursts() {
436430 if ( incStep ) {
437431 console . timeEnd ( `multipleWriteBursts incStep ${ incStep } ` ) ;
438432 console . log ( `Current session pool size: ${ pool . size } ` ) ;
439- console . log ( `Current num write sessions: ${ pool . writes } ` ) ;
440433 }
441434 } finally {
442435 await database . close ( ) ;
@@ -449,46 +442,39 @@ async function oneReadTransactionPerSecond() {
449442 const RND_WAIT_TIME_BETWEEN_REQUESTS = 100000 ;
450443 const NUM_TRANSACTIONS = RND_WAIT_TIME_BETWEEN_REQUESTS / 1000 ;
451444 for ( const minSessions of [ 0 , 25 ] ) {
452- for ( const writeFraction of [ 0 , 0.2 ] ) {
453- const database = newTestDatabase ( {
454- min : minSessions ,
455- writes : writeFraction ,
456- } ) ;
457- const pool = database . pool_ as SessionPool ;
458- try {
459- // Execute a batch of write requests to initialize the session pool with only
460- // write sessions. The dynamic scaling of the session pool should automatically
461- // change this into an appropriate number of read sessions as the test runs.
462- await queueWriteOperations ( database , pool . options . incStep ! , 0 ) ;
463- const readPromises = queueReadOperations (
464- database ,
465- NUM_TRANSACTIONS ,
466- RND_WAIT_TIME_BETWEEN_REQUESTS ,
467- 0
468- ) ;
469- readPromises . forEach ( p =>
470- p . then ( t => {
471- console . log ( `Time taken: ${ t } ms` ) ;
472- } )
473- ) ;
474- const t = await Promise . all ( readPromises ) ;
475- const max = Math . max ( ...t ) ;
476- const min = Math . min ( ...t ) ;
477- const sum = t . reduce ( ( a , b ) => a + b , 0 ) ;
478- const avg = sum / t . length || 0 ;
479- const p90 = percentile ( t , 0.9 ) ;
480- console . log (
481- `oneReadTransactionPerSecond, min: ${ minSessions } , write: ${ writeFraction } `
482- ) ;
483- console . log ( `Max: ${ max } ` ) ;
484- console . log ( `Min: ${ min } ` ) ;
485- console . log ( `Avg: ${ avg } ` ) ;
486- console . log ( `P90: ${ p90 } ` ) ;
487- console . log ( `Current session pool size: ${ pool . size } ` ) ;
488- console . log ( `Current num write sessions: ${ pool . writes } ` ) ;
489- } finally {
490- await database . close ( ) ;
491- }
445+ const database = newTestDatabase ( {
446+ min : minSessions ,
447+ } ) ;
448+ const pool = database . pool_ as SessionPool ;
449+ try {
450+ // Execute a batch of write requests to initialize the session pool with only
451+ // write sessions. The dynamic scaling of the session pool should automatically
452+ // change this into an appropriate number of read sessions as the test runs.
453+ await queueWriteOperations ( database , pool . options . incStep ! , 0 ) ;
454+ const readPromises = queueReadOperations (
455+ database ,
456+ NUM_TRANSACTIONS ,
457+ RND_WAIT_TIME_BETWEEN_REQUESTS ,
458+ 0
459+ ) ;
460+ readPromises . forEach ( p =>
461+ p . then ( t => {
462+ console . log ( `Time taken: ${ t } ms` ) ;
463+ } )
464+ ) ;
465+ const t = await Promise . all ( readPromises ) ;
466+ const max = Math . max ( ...t ) ;
467+ const min = Math . min ( ...t ) ;
468+ const sum = t . reduce ( ( a , b ) => a + b , 0 ) ;
469+ const avg = sum / t . length || 0 ;
470+ const p90 = percentile ( t , 0.9 ) ;
471+ console . log ( `Max: ${ max } ` ) ;
472+ console . log ( `Min: ${ min } ` ) ;
473+ console . log ( `Avg: ${ avg } ` ) ;
474+ console . log ( `P90: ${ p90 } ` ) ;
475+ console . log ( `Current session pool size: ${ pool . size } ` ) ;
476+ } finally {
477+ await database . close ( ) ;
492478 }
493479 }
494480}
@@ -498,43 +484,36 @@ async function oneWriteTransactionPerSecond() {
498484 const RND_WAIT_TIME_BETWEEN_REQUESTS = 100000 ;
499485 const NUM_TRANSACTIONS = RND_WAIT_TIME_BETWEEN_REQUESTS / 1000 ;
500486 for ( const minSessions of [ 0 , 25 ] ) {
501- for ( const writeFraction of [ 0 , 0.2 ] ) {
502- const database = newTestDatabase ( {
503- min : minSessions ,
504- writes : writeFraction ,
505- } ) ;
506- const pool = database . pool_ as SessionPool ;
507- try {
508- // Execute one read request to initialize the session pool.
509- await queueReadOperations ( database , 1 , 0 , 0 ) ;
510- const writePromises = queueWriteOperations (
511- database ,
512- NUM_TRANSACTIONS ,
513- RND_WAIT_TIME_BETWEEN_REQUESTS
514- ) ;
515- writePromises . forEach ( p =>
516- p . then ( t => {
517- console . log ( `Time taken: ${ t } ms` ) ;
518- } )
519- ) ;
520- const t = await Promise . all ( writePromises ) ;
521- const max = Math . max ( ...t ) ;
522- const min = Math . min ( ...t ) ;
523- const sum = t . reduce ( ( a , b ) => a + b , 0 ) ;
524- const avg = sum / t . length || 0 ;
525- const p90 = percentile ( t , 0.9 ) ;
526- console . log (
527- `oneWriteTransactionPerSecond, min: ${ minSessions } , write: ${ writeFraction } `
528- ) ;
529- console . log ( `Max: ${ max } ` ) ;
530- console . log ( `Min: ${ min } ` ) ;
531- console . log ( `Avg: ${ avg } ` ) ;
532- console . log ( `P90: ${ p90 } ` ) ;
533- console . log ( `Current session pool size: ${ pool . size } ` ) ;
534- console . log ( `Current num write sessions: ${ pool . writes } ` ) ;
535- } finally {
536- await database . close ( ) ;
537- }
487+ const database = newTestDatabase ( {
488+ min : minSessions ,
489+ } ) ;
490+ const pool = database . pool_ as SessionPool ;
491+ try {
492+ // Execute one read request to initialize the session pool.
493+ await queueReadOperations ( database , 1 , 0 , 0 ) ;
494+ const writePromises = queueWriteOperations (
495+ database ,
496+ NUM_TRANSACTIONS ,
497+ RND_WAIT_TIME_BETWEEN_REQUESTS
498+ ) ;
499+ writePromises . forEach ( p =>
500+ p . then ( t => {
501+ console . log ( `Time taken: ${ t } ms` ) ;
502+ } )
503+ ) ;
504+ const t = await Promise . all ( writePromises ) ;
505+ const max = Math . max ( ...t ) ;
506+ const min = Math . min ( ...t ) ;
507+ const sum = t . reduce ( ( a , b ) => a + b , 0 ) ;
508+ const avg = sum / t . length || 0 ;
509+ const p90 = percentile ( t , 0.9 ) ;
510+ console . log ( `Max: ${ max } ` ) ;
511+ console . log ( `Min: ${ min } ` ) ;
512+ console . log ( `Avg: ${ avg } ` ) ;
513+ console . log ( `P90: ${ p90 } ` ) ;
514+ console . log ( `Current session pool size: ${ pool . size } ` ) ;
515+ } finally {
516+ await database . close ( ) ;
538517 }
539518 }
540519}
@@ -545,52 +524,45 @@ async function oneReadAndOneWriteTransactionPerSecond() {
545524 const NUM_READ_TRANSACTIONS = RND_WAIT_TIME_BETWEEN_REQUESTS / 1000 ;
546525 const NUM_WRITE_TRANSACTIONS = RND_WAIT_TIME_BETWEEN_REQUESTS / 1000 ;
547526 for ( const minSessions of [ 0 , 25 ] ) {
548- for ( const writeFraction of [ 0 , 0.2 ] ) {
549- const database = newTestDatabase ( {
550- min : minSessions ,
551- writes : writeFraction ,
552- } ) ;
553- const pool = database . pool_ as SessionPool ;
554- try {
555- const readPromises = queueReadOperations (
556- database ,
557- NUM_READ_TRANSACTIONS ,
558- RND_WAIT_TIME_BETWEEN_REQUESTS ,
559- 0
560- ) ;
561- const writePromises = queueWriteOperations (
562- database ,
563- NUM_WRITE_TRANSACTIONS ,
564- RND_WAIT_TIME_BETWEEN_REQUESTS
565- ) ;
566- readPromises . forEach ( p =>
567- p . then ( t => {
568- console . log ( `Read tx: ${ t } ms` ) ;
569- } )
570- ) ;
571- writePromises . forEach ( p =>
572- p . then ( t => {
573- console . log ( `Write tx: ${ t } ms` ) ;
574- } )
575- ) ;
576- const t = await Promise . all ( readPromises . concat ( writePromises ) ) ;
577- const max = Math . max ( ...t ) ;
578- const min = Math . min ( ...t ) ;
579- const sum = t . reduce ( ( a , b ) => a + b , 0 ) ;
580- const avg = sum / t . length || 0 ;
581- const p90 = percentile ( t , 0.9 ) ;
582- console . log (
583- `oneReadAndOneWriteTransactionPerSecond, min: ${ minSessions } , write: ${ writeFraction } `
584- ) ;
585- console . log ( `Max: ${ max } ` ) ;
586- console . log ( `Min: ${ min } ` ) ;
587- console . log ( `Avg: ${ avg } ` ) ;
588- console . log ( `P90: ${ p90 } ` ) ;
589- console . log ( `Current session pool size: ${ pool . size } ` ) ;
590- console . log ( `Current num write sessions: ${ pool . writes } ` ) ;
591- } finally {
592- await database . close ( ) ;
593- }
527+ const database = newTestDatabase ( {
528+ min : minSessions ,
529+ } ) ;
530+ const pool = database . pool_ as SessionPool ;
531+ try {
532+ const readPromises = queueReadOperations (
533+ database ,
534+ NUM_READ_TRANSACTIONS ,
535+ RND_WAIT_TIME_BETWEEN_REQUESTS ,
536+ 0
537+ ) ;
538+ const writePromises = queueWriteOperations (
539+ database ,
540+ NUM_WRITE_TRANSACTIONS ,
541+ RND_WAIT_TIME_BETWEEN_REQUESTS
542+ ) ;
543+ readPromises . forEach ( p =>
544+ p . then ( t => {
545+ console . log ( `Read tx: ${ t } ms` ) ;
546+ } )
547+ ) ;
548+ writePromises . forEach ( p =>
549+ p . then ( t => {
550+ console . log ( `Write tx: ${ t } ms` ) ;
551+ } )
552+ ) ;
553+ const t = await Promise . all ( readPromises . concat ( writePromises ) ) ;
554+ const max = Math . max ( ...t ) ;
555+ const min = Math . min ( ...t ) ;
556+ const sum = t . reduce ( ( a , b ) => a + b , 0 ) ;
557+ const avg = sum / t . length || 0 ;
558+ const p90 = percentile ( t , 0.9 ) ;
559+ console . log ( `Max: ${ max } ` ) ;
560+ console . log ( `Min: ${ min } ` ) ;
561+ console . log ( `Avg: ${ avg } ` ) ;
562+ console . log ( `P90: ${ p90 } ` ) ;
563+ console . log ( `Current session pool size: ${ pool . size } ` ) ;
564+ } finally {
565+ await database . close ( ) ;
594566 }
595567 }
596568}
@@ -605,7 +577,6 @@ async function steadyIncrease() {
605577 const database = newTestDatabase ( {
606578 min : 100 ,
607579 max : 400 ,
608- writes : 0.2 ,
609580 incStep : incStep ,
610581 } ) ;
611582 const pool = database . pool_ as SessionPool ;
0 commit comments