6. Desarrollo de la aplicación
6.1 Diseño de interfaz de usuario
7.4
Running the YCSB+T benchmark
Here we discuss the various steps to setup and run the YCSB+T benchmark.
7.4.1
Setup the data stores
The first step before the benchmark can be run is to make sure the data store access credentials are all setup correctly. The exact details of how this is done depends on the specific data store.
Once the data store credentials are setup, data records can be loaded into the data store. This is done by running YCSB+T with the -load option. Listing 7.1 is an example of how this is done.
1 $ java com . yahoo . ycsb . C l i e n t −db com . yahoo . ycsb . db . RawHttpDB \ 2 −P w o r k l o a d s / c l o s e d e c o n o m y w o r k l o a d −l o a d
Listing 7.1: YCSB+T client load data store command
7.4.2
Workload properties
The workload properties file consists of many tuneable parameters. The most commonly altered ones are listed below:
Ratio of data store operations The ratio of operations on the records in the data store can be controlled using the workload propertied file. This is done by varying the readproportion, updateproportion, insert- proportion, readmodifywriteproportion and scanproportion parameters to vary the proportion of read, update, insert, read-modify-write and scan operations. Each of these values must be a value between 0 and 1 indicating the probability of the operation to occur. The sum of all these values must all add up to 1.
Key distribution The distribution used to select the keys of the records to op- erate on is done by setting the requestdistribution parameter. The valid values for this parameter can be zipfian, hotspot, uniform, skewed, or ex- ponential corresponding to the ZipfianGenerator, HotspotGenerator, Uni- formGenerator, SkewedGenerator and ExponentialGenerator key generator classes respectively.
The theta parameter to the Zipfian generator can be controlled by setting the zipfianrequestdistributiontheta parameter which takes a value between 0.1 to 0.99 in order to vary the contention from less to more respectively. The default value of the parameter is 0.99.
Operation count The number of data store operations to be performed dur- ing the transaction execution phase of the benchmark is controlled by the operationcount parameter.
Record count The number of records to create in the load phase and the number to operate on during the transaction phase is controlled by the recordcount parameter.
Histogram of results The default behaviour of YCSB (and YCSB+T) is to capture the latency distribution of all the operations on the data store in the form of a histogram. The number of histogram buckets to capture are controlled by the histogram.buckets parameter. It is important to note that there is small cost of maintaining the histogram on the performance of the benchmark. Therefore, it is useful to know that it can be set to 0 in order to collect metrics in only one bucket.
7.4.3
Defining new workloads
The YCSB class called Workload can be extended to implemented any new func- tionality. The ClosedEconomyWorkload is an extension of the Workload class. It implements a rudimentary data validation stage by implementing the public boolean validate(DB db) Workload method. The listing below in Listing 7.2.
1 // P e r f o r m v a l i d a t i o n o f t h e d a t a b a s e d b a f t e r t h e w o r k l o a d h a s e x e c u t e d . 2 // 3 // @ r e t u r n f a l s e i f t h e w o r k l o a d l e f t t h e d a t a b a s e i n an i n c o n s i s t e n t s t a t e , t r u e i f i t i s c o n s i s t e n t . 4 // @ t h r o w s W o r k l o a d E x c e p t i o n 5 p u b l i c boolean v a l i d a t e (DB db ) throws W o r k l o a d E x c e p t i o n {
6 HashSet<S t r i n g > f i e l d s =new HashSet<S t r i n g >() ;
7 f i e l d s . add ( ” f i e l d 0 ” ) ;
8 System . o u t . p r i n t l n ( ” V a l i d a t i n g d a t a ” ) ;
9 HashMap<S t r i n g , B y t e I t e r a t o r > v a l u e s =new HashMap<S t r i n g , B y t e I t e r a t o r >() ;
10 i n t c o u n t e d s u m = 0 ; 11 f o r (i n t i = 0 ; i < r e c o r d c o u n t ; i ++) { 12 S t r i n g keyname = buildKeyName ( v a l i d a t i o n k e y s e q u e n c e . n e x t I n t ( ) ) ; 13 t ry { 14 db . s t a r t ( ) ; 15 db . r e a d ( t a b l e , keyname , f i e l d s , v a l u e s ) ; 16 db . commit ( ) ; 17 } catch ( DBException e ) {
7.5. AN EXAMPLE EXECUTION OF YCSB+T 145