{"id":5848,"date":"2018-10-06T13:32:50","date_gmt":"2018-10-06T20:32:50","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=5848"},"modified":"2025-06-13T20:19:56","modified_gmt":"2025-06-14T03:19:56","slug":"ycsb-json-implementation-for-couchbase-and-mongodb","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/","title":{"rendered":"YCSB-JSON: Implementation for Couchbase and MongoDB"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">YCSB is a great benchmarking tool built to be easily extended by any driver which supports and implements basic operations like: insert, read, update, delete and scan.\u00a0<\/span><span style=\"font-weight: 400;\">Plain synthetic data introduced by YCSB fits this paradigm perfectly. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">But when it comes to working with JSON databases such as Couchbase and MongoDB, YCSB is helpful because queries became way more sophisticated: querying arrays and nested objects, running joins, and aggregations.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The YCSB-JSON extension on one hand should be able to utilize all possible JSON operations supported by a database.<br \/>\n<\/span><span style=\"font-weight: 400;\">On the other hand, implementing this approach should be generic enough to be easily extended from YCSB and MongoDB, Couchbase, or\u00a0<em>any<\/em> other database driver, no matter what level of JSON querying it supports.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The YCSB-JSON connection is designed to better emulate realistic, end-user scenarios. It is designed to work on any JSON data either real datasets or pseudo-realistic or fully synthetic. And one of the requirements for the tool is that there shouldn\u2019t be any hardcoded values in query predicates. Users can only control the data cardinality during the dataset generation process.\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-5864 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/YCSB-JSON-Implementation-300x232.png\" alt=\"\" width=\"656\" height=\"507\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/YCSB-JSON-Implementation-300x232.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/YCSB-JSON-Implementation-768x594.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/YCSB-JSON-Implementation-20x15.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/YCSB-JSON-Implementation.png 830w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/p>\n<p class=\"\" style=\"text-align: center;\">\u00a0Fig 1. YCSB-JSON implementation at a glance<\/p>\n<h4><b>Data Model<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">The \u00a0data model we choose for this benchmark is well described in this article: <\/span><a href=\"https:\/\/dzone.com\/articles\/ycsb-json-benchmarking-json-databases-by-extending\"><span style=\"font-weight: 400;\">https:\/\/dzone.com\/articles\/ycsb-json-benchmarking-json-databases-by-extending<\/span><\/a><br \/>\n<span style=\"font-weight: 400;\">The dataset is generated by using a fakeit tool and loaded into a database (Couchbase, MongoDB) by external scripts. <\/span><span style=\"font-weight: 400;\">While the model is defined and fixed values are randomly generated, this data is randomly generated but it&#8217;s not synthetic.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h4><b>Data Management <\/b><\/h4>\n<p><span style=\"font-weight: 400;\">For each operation in the workload queries are fixed, but bound values for each parameterized predicate are non-deterministic. So, the following data management flow was chosen:<br \/>\n<\/span><\/p>\n<ol>\n<li><span style=\"font-weight: 400;\">Generate documents by fakeit.\u00a0<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Load generated \u00a0data to a database by any external script.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Run the load phase. During this phase the YCSB will read a random subset of the generated documents, store all its values in its internal cache.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">During the run phase the YCSB will use the values from its cache while binding and executing queries against the database.<\/span><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h4><b>Predicates Generator<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">The YCSB uses generators when operating with data. The connector introduces its own generator mapped to a particular data model. The mapping and the model exists only within the generator namespace. The generator output is a set of generic predicates (field-value pairs) for particular queries. This allows users to modify models\u00a0 and extend the tool with other queries without modifying the rest of the core code.<\/span><\/p>\n<h5><span style=\"font-weight: 400;\">Predicates generator: <a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/generator\/soe\/Generator.java\">Generator.java\u00a0<\/a><\/span><\/h5>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Example #1:\u00a0 <strong>Pagination query<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">One of the YCSB-JSON operations, the pagination query, can be represented by the following statement:<br \/>\n<\/span><\/p>\n<p><em><span style=\"font-weight: 400;\">SELECT * FROM &lt;bucket&gt; WHERE address.zip = &lt;value&gt; OFFSET &lt;num&gt; LIMIT &lt;num&gt;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400;\">The query predicate is a field within an object. When using Couchbase N1QL the field can be simply accessed as \u201caddress.zip\u201d. But other databases might not be as flexible so the YCSB-JSON generator creates 2 predicates: the parent predicate (address) and child\/nested predicate (zip).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">And the child predicate has a value randomly picked from the list of sample values for this particular field.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The function below generates the <a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/workloads\/soe\/SoeQueryPredicate.java\">SoeQueryPredicate object<\/a><br \/>\n<\/span><span style=\"font-weight: 400;\">Where <code>name<\/code> is \u201c<\/span><span style=\"font-weight: 400;\">address<\/span><span style=\"font-weight: 400;\">\u201d<br \/>\n<\/span><span style=\"font-weight: 400;\">And <code>nested predicate<\/code> is another SoeQueryPredicate object with name \u201c<\/span><span style=\"font-weight: 400;\">zip<\/span><span style=\"font-weight: 400;\">\u201d and value <\/span><span style=\"font-weight: 400;\">\u00a0&lt;value&gt;:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5851\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/Screen-Shot-2018-10-02-at-10.09.25-AM-300x89.png\" alt=\"\" width=\"991\" height=\"294\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.09.25-AM-300x89.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.09.25-AM-768x227.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.09.25-AM-20x6.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.09.25-AM.png 858w\" sizes=\"auto, (max-width: 991px) 100vw, 991px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Example #2 \u00a0<strong>Report query<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">Predicates for more complex queries are generated the same way. With only difference that when query introduces multiple predicates the predicates sequence (array of predicates) is being generated instead for a single predicate. Here is the Report query:<\/span><\/p>\n<p><em><span style=\"font-weight: 400;\">SELECT \u00a0o2.month, c2.address.zip, SUM(o2.sale_price) <\/span><\/em><em><span style=\"font-weight: 400;\">FROM &lt;bucket&gt; c2<br \/>\nINNER JOIN orders o2 ON KEYS c2.order_list<br \/>\n<\/span><span style=\"font-weight: 400;\">WHERE c2.address.zip = \u201cvalue\u201d AND o2.month = \u201cvalue\u201d<br \/>\n<\/span><span style=\"font-weight: 400;\">GROUP BY o2.month, c2.address.zip ORDER BY SUM(o2.sale_price)<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400;\">Function below generates sequence of:<br \/>\n<\/span><span style=\"font-weight: 400;\">\u201cMonth\u201d predicate, \u201caddress\u201d predicate with nested \u201czip\u201d predicate, \u201csale_price\u201d predicate, etc:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5852\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/Screen-Shot-2018-10-02-at-10.13.34-AM-300x217.png\" alt=\"\" width=\"942\" height=\"681\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.13.34-AM-300x217.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.13.34-AM-1024x741.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.13.34-AM-768x555.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.13.34-AM-20x14.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.13.34-AM.png 1113w\" sizes=\"auto, (max-width: 942px) 100vw, 942px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Other queries generators can be found here:<br \/>\n<\/span><a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/generator\/soe\/Generator.java\"><span style=\"font-weight: 400;\">https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/generator\/soe\/Generator.java<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h4><b>New Operations<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">The code needs to be updated with new operations. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Signatures in DB class:\u00a0<\/span><br \/>\n<a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/DB.java#L140\"><span style=\"font-weight: 400;\">https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/DB.java#L140<\/span><\/a>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5853\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/Screen-Shot-2018-10-02-at-10.16.42-AM-260x300.png\" alt=\"\" width=\"1013\" height=\"1169\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.16.42-AM-260x300.png 260w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.16.42-AM-768x885.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.16.42-AM-300x346.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.16.42-AM-17x20.png 17w\" sizes=\"auto, (max-width: 1013px) 100vw, 1013px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Implementations in DBWrapper:\u00a0<\/span><br \/>\n<a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/DBWrapper.java#L346\"><span style=\"font-weight: 400;\">https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/DBWrapper.java#L346<\/span><\/a>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5854\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/Screen-Shot-2018-10-02-at-10.19.53-AM-257x300.png\" alt=\"\" width=\"707\" height=\"825\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.19.53-AM-257x300.png 257w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.19.53-AM-879x1024.png 879w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.19.53-AM-768x895.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.19.53-AM-300x350.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.19.53-AM-17x20.png 17w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.19.53-AM.png 1040w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Extending CoreWorkload with new operations: <a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/core\/src\/main\/java\/com\/yahoo\/ycsb\/workloads\/soe\/SoeWorkload.java\">SoeWorkload.java<\/a><\/span><\/p>\n<p>&nbsp;<\/p>\n<h4><b>Implementation of YCSB-JSON Operations for<\/b><strong>\u00a0Couchbase and MongoDB<\/strong><\/h4>\n<p><span style=\"font-weight: 400;\">The DB driver function of a YCSB-JSON operation takes an additional parameter which is a generator object. It is being passed by the Workload class and it has a particular predicate sequence prebuilt.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Because predicates structure and sequences are well defined by the \u00a0generator a DB driver can access names and values directly and construct the query using its native query language or other access methods. Below are examples of implementing Page and Report queries.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Page query,<\/strong>\u00a0generating query statement for Couchbase:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5855\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/Screen-Shot-2018-10-02-at-10.24.14-AM-300x68.png\" alt=\"\" width=\"966\" height=\"219\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.24.14-AM-300x68.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.24.14-AM-768x175.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.24.14-AM-20x5.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.24.14-AM.png 1016w\" sizes=\"auto, (max-width: 966px) 100vw, 966px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">for MongoDB:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5856\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/Screen-Shot-2018-10-02-at-10.25.14-AM-300x128.png\" alt=\"\" width=\"888\" height=\"379\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.25.14-AM-300x128.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.25.14-AM-1024x438.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.25.14-AM-768x328.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.25.14-AM-20x9.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.25.14-AM.png 1114w\" sizes=\"auto, (max-width: 888px) 100vw, 888px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">\f<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Report query<\/strong>, Couchbase:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5858\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/Screen-Shot-2018-10-02-at-10.28.10-AM-300x126.png\" alt=\"\" width=\"1105\" height=\"464\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.28.10-AM-300x126.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.28.10-AM-1024x429.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.28.10-AM-768x322.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.28.10-AM-20x8.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.28.10-AM.png 1144w\" sizes=\"auto, (max-width: 1105px) 100vw, 1105px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">MongoDB:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5857\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/Screen-Shot-2018-10-02-at-10.29.47-AM-291x300.png\" alt=\"\" width=\"994\" height=\"1025\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.29.47-AM-291x300.png 291w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.29.47-AM-994x1024.png 994w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.29.47-AM-768x791.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.29.47-AM-300x309.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.29.47-AM-20x20.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/Screen-Shot-2018-10-02-at-10.29.47-AM.png 1171w\" sizes=\"auto, (max-width: 994px) 100vw, 994px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">All Couchbase implementations:\u00a0<a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/couchbase2\/src\/main\/java\/com\/yahoo\/ycsb\/db\/couchbase2\/Couchbase2Client.java\">Couchbase2Client.java<\/a><\/span><\/p>\n<p><span style=\"font-weight: 400;\">All MongoDB implementations:\u00a0<a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/blob\/soe\/mongodb\/src\/main\/java\/com\/yahoo\/ycsb\/db\/MongoDbClient.java\">MongoDbClient.java<\/a><\/span><\/p>\n<h4><\/h4>\n<h4><strong>References<\/strong><\/h4>\n<p>Article part 1:<br \/>\n<a href=\"https:\/\/www.couchbase.com\/blog\/ycsb-json-benchmarking-json-databases-by-extending-ycsb\/\">\u00a0https:\/\/www.couchbase.com\/blog\/ycsb-json-benchmarking-json-databases-by-extending-ycsb\/<\/a><\/p>\n<p>YCSB-JSON Implementation:<br \/>\n<a href=\"https:\/\/github.com\/couchbaselabs\/YCSB\/tree\/soe\">https:\/\/github.com\/couchbaselabs\/YCSB\/tree\/soe<\/a><\/p>\n<p>FakeIt:<br \/>\n<a href=\"https:\/\/github.com\/bentonam\/fakeit\">\u00a0https:\/\/github.com\/bentonam\/fakeit<\/a><\/p>\n<h4><\/h4>\n<h4><b>Next steps<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Implement fakeit-like generator in to simplify data and query predicates generation.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>YCSB is a great benchmarking tool built to be easily extended by any driver which supports and implements basic operations like: insert, read, update, delete and scan.\u00a0Plain synthetic data introduced by YCSB fits this paradigm perfectly. But when it comes [&hellip;]<\/p>\n","protected":false},"author":23019,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1814,1821,1816,1819,9417,1812,2201],"tags":[2279,1572,1261,1309,1725,2278],"ppma_author":[9074],"class_list":["post-5848","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-couchbase-architecture","category-couchbase-server","category-data-modeling","category-performance","category-n1ql-query","category-tools-sdks","tag-benchmark","tag-database","tag-json","tag-mongodb","tag-nosql-database","tag-ycsb"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>YCSB-JSON: Implementation for Couchbase and MongoDB<\/title>\n<meta name=\"description\" content=\"For JSON databases such as Couchbase and MongoDB, YCSB is helpful for executing more sophisticated queries. Learn how to use YCSB-JSON today.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"YCSB-JSON: Implementation for Couchbase and MongoDB\" \/>\n<meta property=\"og:description\" content=\"For JSON databases such as Couchbase and MongoDB, YCSB is helpful for executing more sophisticated queries. Learn how to use YCSB-JSON today.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-06T20:32:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:19:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/YCSB-JSON-Implementation.png\" \/>\n\t<meta property=\"og:image:width\" content=\"830\" \/>\n\t<meta property=\"og:image:height\" content=\"642\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Alex Gyryk\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alex Gyryk\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/\"},\"author\":{\"name\":\"Alex Gyryk\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/cf7700be3c6aa11a0e343b4e772d370f\"},\"headline\":\"YCSB-JSON: Implementation for Couchbase and MongoDB\",\"datePublished\":\"2018-10-06T20:32:50+00:00\",\"dateModified\":\"2025-06-14T03:19:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/\"},\"wordCount\":879,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"benchmark\",\"database\",\"JSON\",\"mongodb\",\"NoSQL Database\",\"ycsb\"],\"articleSection\":[\"Application Design\",\"Couchbase Architecture\",\"Couchbase Server\",\"Data Modeling\",\"High Performance\",\"SQL++ \/ N1QL Query\",\"Tools &amp; SDKs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/\",\"name\":\"YCSB-JSON: Implementation for Couchbase and MongoDB\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2018-10-06T20:32:50+00:00\",\"dateModified\":\"2025-06-14T03:19:56+00:00\",\"description\":\"For JSON databases such as Couchbase and MongoDB, YCSB is helpful for executing more sophisticated queries. Learn how to use YCSB-JSON today.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"YCSB-JSON: Implementation for Couchbase and MongoDB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/cf7700be3c6aa11a0e343b4e772d370f\",\"name\":\"Alex Gyryk\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/9626fc579c5bf8bdb5fa4d15149f816a\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/baaaa3ba944997d5062b1e71633c1645559a8a91739c8509f659c16283fddc0e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/baaaa3ba944997d5062b1e71633c1645559a8a91739c8509f659c16283fddc0e?s=96&d=mm&r=g\",\"caption\":\"Alex Gyryk\"},\"description\":\"Alex Gyryk is a Principal Software Engineer, Performance at Couchbase. Prior to joining Couchbase, he spent a few years in Forte Group as Senior Performance Analyst.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/oleksandr-gyrykcouchbase-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"YCSB-JSON: Implementation for Couchbase and MongoDB","description":"For JSON databases such as Couchbase and MongoDB, YCSB is helpful for executing more sophisticated queries. Learn how to use YCSB-JSON today.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/","og_locale":"en_US","og_type":"article","og_title":"YCSB-JSON: Implementation for Couchbase and MongoDB","og_description":"For JSON databases such as Couchbase and MongoDB, YCSB is helpful for executing more sophisticated queries. Learn how to use YCSB-JSON today.","og_url":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/","og_site_name":"The Couchbase Blog","article_published_time":"2018-10-06T20:32:50+00:00","article_modified_time":"2025-06-14T03:19:56+00:00","og_image":[{"width":830,"height":642,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/YCSB-JSON-Implementation.png","type":"image\/png"}],"author":"Alex Gyryk","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Alex Gyryk","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/"},"author":{"name":"Alex Gyryk","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/cf7700be3c6aa11a0e343b4e772d370f"},"headline":"YCSB-JSON: Implementation for Couchbase and MongoDB","datePublished":"2018-10-06T20:32:50+00:00","dateModified":"2025-06-14T03:19:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/"},"wordCount":879,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["benchmark","database","JSON","mongodb","NoSQL Database","ycsb"],"articleSection":["Application Design","Couchbase Architecture","Couchbase Server","Data Modeling","High Performance","SQL++ \/ N1QL Query","Tools &amp; SDKs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/","url":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/","name":"YCSB-JSON: Implementation for Couchbase and MongoDB","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2018-10-06T20:32:50+00:00","dateModified":"2025-06-14T03:19:56+00:00","description":"For JSON databases such as Couchbase and MongoDB, YCSB is helpful for executing more sophisticated queries. Learn how to use YCSB-JSON today.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/ycsb-json-implementation-for-couchbase-and-mongodb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"YCSB-JSON: Implementation for Couchbase and MongoDB"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/cf7700be3c6aa11a0e343b4e772d370f","name":"Alex Gyryk","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/9626fc579c5bf8bdb5fa4d15149f816a","url":"https:\/\/secure.gravatar.com\/avatar\/baaaa3ba944997d5062b1e71633c1645559a8a91739c8509f659c16283fddc0e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/baaaa3ba944997d5062b1e71633c1645559a8a91739c8509f659c16283fddc0e?s=96&d=mm&r=g","caption":"Alex Gyryk"},"description":"Alex Gyryk is a Principal Software Engineer, Performance at Couchbase. Prior to joining Couchbase, he spent a few years in Forte Group as Senior Performance Analyst.","url":"https:\/\/www.couchbase.com\/blog\/author\/oleksandr-gyrykcouchbase-com\/"}]}},"authors":[{"term_id":9074,"user_id":23019,"is_guest":0,"slug":"oleksandr-gyrykcouchbase-com","display_name":"Alex Gyryk","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/baaaa3ba944997d5062b1e71633c1645559a8a91739c8509f659c16283fddc0e?s=96&d=mm&r=g","author_category":"","last_name":"Gyryk","first_name":"Alex","job_title":"","user_url":"","description":"Alex Gyryk is a Principal Software Engineer, Performance at Couchbase. Prior to joining Couchbase, he spent a few years in Forte Group as Senior Performance Analyst."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/5848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/23019"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=5848"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/5848\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=5848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=5848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=5848"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=5848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}