filterKey: project
filterKey: project
{"id":1758,"date":"2012-07-15T13:14:39","date_gmt":"2012-07-15T17:14:39","guid":{"rendered":"http:\/\/hstore.cs.brown.edu\/?page_id=1758"},"modified":"2013-06-14T00:30:58","modified_gmt":"2013-06-14T04:30:58","slug":"transaction-models","status":"publish","type":"page","link":"https:\/\/hstore.cs.brown.edu\/documentation\/development\/transaction-models\/","title":{"rendered":"Transaction Prediction Models"},"content":{"rendered":"

\u00ab<\/B> Transaction Parameter Mappings<\/a><\/div>
System Stored Procedures<\/a> \u00bb<\/B><\/div>
<\/div><\/p>\n

The following is instructions on how to generate and use H-Store’s Markov models for a benchmark workload. This will allow H-Store’s TransactionEstimator component to predict what transactions will do before they execute and then apply the correct optimizations automatically. <\/p>\n

Need to discuss difference between global and clustered models…<\/i><\/p>\n

Generating Models<\/h2>\n

The models are specific to the number of partitions in the cluster, therefore you need to generate new models for each new cluster configuration. <\/p>\n

We will first create a cluster for the TPC-C benchmark with two partitions:<\/p>\n

ant hstore-prepare<\/tt> -Dproject=tpcc -Dhosts=localhost:0:0<\/pre>\n

You can construct markov file with the markov-generate<\/tt> command with this workload:<\/p>\n

ant markov-generate<\/tt> -Dproject=tpcc \\\r\n    -Dworkload=files\/workloads\/tpcc.8p-1.trace.gz \\\r\n    -Dglobal=false \\\r\n    -Doutput=tpcc.markov<\/pre>\n

You can use the following command to create Markov models for multiple cluster sizes and then gzip them:<\/p>\n

export benchmark=seats\r\nfor partitions in 8 16 32; do\r\n  ant hstore-prepare markov-generate \\\r\n       -Dproject=${benchmark} \\\r\n       -Dhosts=localhost:0:0-$(expr $partitions - 1) \\\r\n       -Dglobal=false \\\r\n       -Dworkload=${benchmark}-combined.trace.gz \\\r\n       -Doutput=files\/markovs\/vldb-june2013\/${benchmark}-${partitions}p.markov || break \r\n  gzip -v --force --best files\/markovs\/vldb-june2013\/${benchmark}-${partitions}p.markov\r\ndone<\/pre>\n

Executing Benchmarks using Prediction Models<\/h2>\n

The H-Store supplemental files<\/a> repository contains several pre-compute Markov models<\/a> for the built-in benchmarks. To start the H-Store cluster using a set of Markov models, execute the hstore-benchmark<\/tt> target with the site.markov_enable<\/a> and site.markov_path<\/a> parameters:<\/p>\n

\r\nant hstore-prepare<\/tt> -Dproject=tpcc -Dhosts=localhost:0:0-5\r\nant hstore-benchmark<\/tt> -Dproject=tpcc \\\r\n    -Dsite.markov_enable=true \\\r\n    -Dsite.markov_path=files\/markovs\/vldb-august2012\/tpcc-6p.markov.gz<\/pre>\n

You can also have the BenchmarkController<\/tt> recompute the probabilities for all of the Markov models at each partition and save them to a file after a benchmark run using the markov.recompute_end<\/tt> option. Note that the site.markov_singlep_updates<\/a> and site.markov_dtxn_updates<\/a> parameters should be set to true so that the vertexes in each model is updated as transactions execute:<\/p>\n

\r\nant hstore-benchmark<\/tt> -Dproject=tpcc \\\r\n    -Dsite.markov_enable=true \\\r\n    -Dsite.markov_path=files\/markovs\/vldb-august2012\/tpcc-6p.markov.gz \\\r\n    -Dsite.markov_singlep_updates=true \\\r\n    -Dsite.markov_dtxn_updates=true \\\r\n    -Dmarkov.recompute_end=true\r\n<\/pre>\n

Extracting & Visualizing Markov Graphs<\/h2>\n

You can extract individual Markov models and generate GraphViz compatible file of its structure using the markov-graphviz<\/tt> command. This will write out individual files for each Procedure to the directory defined by global.temp_dir<\/a>. The procedure<\/tt> parameter is a comma-separated list of the Procedures that you want to extract. The partition<\/tt> is what partition to use when retrieving the Markov models (when using a non-global Markov set).<\/p>\n

\r\nant markov-graphviz -Dproject=smallbank \\\r\n    -Dmarkov=files\/markovs\/vldb-august2012\/smallbank-2p.markov.gz \\\r\n    -Dprocedure=\"SendPayment,Amalgamate\" \\\r\n    -Dpartition=1\r\n<\/pre>\n

Use GraphViz’s dot<\/tt> tool to generate a PNG (or any other image format) for the extracted Markov file:<\/p>\n

dot -Tpng SendPayment.dot -o SendPayment.png<\/pre>\n

Additional Information<\/h2>\n

See the 2011 VLDB paper for a more thorough discussion of this research.<\/p>\n