{"value":"[Application developers love Redis](https://insights.stackoverflow.com/survey/2021#most-loved-dreaded-and-wanted-database-love-dread) because it has a large and vibrant open source community, provides blazing-fast in-memory performance, and has a developer-friendly yet powerful API that provides native support for multiple data structures. These traits make Redis a great fit for building and running high-performance, scalable web applications.\n\nAt AWS, we offer two fully-managed, Redis-based services: [Amazon ElastiCache for Redis](https://aws.amazon.com/cn/elasticache/redis/) for caching and ephemeral data storage, and [Amazon MemoryDB for Redis](https://aws.amazon.com/cn/memorydb/), an in-memory primary database for applications that require a higher level of data durability. [Our customers](https://aws.amazon.com/cn/elasticache/redis/customers/) use these services to accelerate performance for a wide range of use cases, from mobile payments to gaming leaderboards, Internet of Things (IoT) analytics, ride sharing, and real-time ad serving. They’ve chosen us because of our track record of operational stability and the price-performance enhancements that we’ve made, such as [Enhanced IO](https://aws.amazon.com/cn/blogs/database/boosting-application-performance-and-reducing-costs-with-amazon-elasticache-for-redis/), [multi-flow TCP](https://aws.amazon.com/cn/blogs/database/reduce-cost-and-boost-throughput-with-global-datastore-for-amazon-elasticache-for-redis/), and [data tiering](https://aws.amazon.com/cn/blogs/database/scale-your-amazon-elasticache-for-redis-clusters-at-a-lower-cost-with-data-tiering/).\n\nToday, we’re excited to announce that we’re unlocking even more power for Redis application developers by providing native support for JavaScript Object Notation (JSON) within ElastiCache and MemoryDB. JSON is a near ubiquitous way to encode and exchange data, and it’s now even simpler to store and access JSON documents inside ElastiCache and MemoryDB. This launch simplifies ElastiCache caching for our purpose-built document database, [Amazon DocumentDB (with MongoDB compatibility)](https://aws.amazon.com/cn/documentdb/), as well as working with durable JSON inside MemoryDB. JSON support is available in all ElastiCache and MemoryDB regions at no additional cost. To get started, simply create a new cluster using Redis version 6.2 or greater and you’ll have the new JSON data type and associated commands available.\n\nThe rest of this post will cover how our JSON support works at a more technical level and provide examples of how you can write JSON documents, efficiently fetch or set portions of a JSON document in Redis, and search your JSON documents’ content using [the Goessner-style](https://goessner.net/articles/JsonPath/) JSONPath query language.\n\n### **JSON in ElastiCache and MemoryDB**\n\nAlthough JSON is a standard serialization format for the interchange of structured data (RFC 8259, ECMA 404), JSON support in ElastiCache and MemoryDB provides much more than simple storage and retrieval of JSON-encoded data. It simplifies the development of applications that store complex data structures by providing powerful searching and filtering capabilities. As shown in the following section, many application operations on complex data structures that previously required substantial development time as well as multiple expensive network round-trips can be easily and naturally expressed in a single JSON command. This results in a dramatic improvement in developer productivity and system improvement, as well as reduction in operational costs.\n\nThe new Redis JSON datatype offers six types of values, four primitive (null, boolean, number, and string), and two composite (object and array). The composites map either a string or a dense integer key to a value. However, unlike other Redis composites, JSON composites can contain any of the six value types in any combination, including other JSON composites, i.e., recursion. The ability to freely intermix these value types provides a natural way to represent nearly any structured data.\n\nClient applications use the serialized format to communicate with the service. However, internally the data is stored using a tree-like binary format for efficient traversal and manipulation. The tree-like format allows operations to be performed on sub-trees just as efficiently as when operating on an entire JSON key. In the following description, the term “element” will be used generically to indicate any JSON value, including when the value is just a primitive like a string or a number or when it’s a composite of other values.\n\nThe JSON datatype is fully integrated into the Redis access control lists (ACL) capability. All JSON commands correctly enforce any keyspace or command restrictions or permissions. Just like the existing per-datatype categories (```@string```, ```@hash```, etc.) a new category ```@json``` is added to simplify managing access to JSON commands and data.\n\nMost JSON commands accept not only a key, but also one or more paths. A path is an expression that identifies the element or elements of the JSON document within the key on which the command is to operate. The syntax and semantics of the path closely follow the original [Goessner JSONPath proposal.](https://goessner.net/articles/JsonPath/) See [our documentation](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/json-document-overview.html#json-path-syntax) for more information about JSONPath.\n\n### **Redis and JSON in action**\n\nTo illustrate some of the power of JSON data and JSON paths, let’s take a data structure, such as a list of employees, and see how some simple operations can be coded.\n\nWe’ll represent the list of employees as an array of objects, one object for each employee. Our example data is as follows:\n```\nredis-cli --raw -x json.set key . << EOF\n[\n {\n \"ID\" : 21,\n \"Name\" : \"Audrey\", \n \"Gender\" : \"Female\",\n \"HireDate\" : \"2020.07.31\",\n \"Building\" : \"F1\"\n },\n {\n \"ID\" : 15,\n \"Name\" : \"Bette\", \n \"Gender\" : \"Female\",\n \"HireDate\" : \"2021.01.31\",\n \"Building\" : \"F1\"\n },\n {\n \"ID\" : 75,\n \"Name\" : \"Craig\", \n \"Gender\" : \"Male\",\n \"HireDate\" : \"2022.02.15\",\n \"Building\" : \"F2\"\n },\n {\n \"ID\" : 9,\n \"Name\" : \"Dwayne\", \n \"Gender\" : \"Male\",\n \"HireDate\" : \"2020.10.02\",\n \"Building\" : \"F2\"\n },\n {\n \"ID\" : 3,\n \"Name\" : \"Edith\", \n \"Gender\" : \"Female\",\n \"HireDate\" : \"2018.08.22\",\n \"Building\" : \"F21\"\n }\n]\nEOF\n```\n\nFetching an employee object by an attribute like the “ID” field is simple:\n\n```\njson.get key $[?(@.ID==21)]\n[{\"ID\":21,\"Name\":\"Audrey\",\"Gender\":\"Female\",\"HireDate\":\"2020.07.31\",\"Building\":\"F1\"}]\n```\n\nThere’s no reason that the selection attribute can’t have multiple responses. Here the query returns the employee records of all of the employees located in building F2:\n\n```\njson.get key $[?(@.Building==\"F2\")]\n[{\"ID\":75,\"Name\":\"Craig\",\"Gender\":\"Male\",\"HireDate\":\"2022.02.15\",\"Building\":\"F2\"},\n {\"ID\":9,\"Name\":\"Dwayne\",\"Gender\":\"Male\",\"HireDate\":\"2020.10.02\",\"Building\":\"F2\"}]\n```\n\nBut, you don’t have to fetch entire employee records, you can pick a field like ID to be returned. This query returns the ID of all of the female employees:\n\n```\njson.get key $[?(@.Gender==\"Female\")].ID\n[21,15,3]\n```\n\nEven though JSON doesn’t have a dedicated primitive for timestamps, you can use strings to represent them. This query returns all of the employees hired since January 1, 2020:\n\n```\njson.get key $[?(@.HireDate>\"2020.00.00\")].ID\n[21,15,75,9]\n```\n\nQuery filters aren’t limited to a single field, and you can combine multiple filters. This query finds all of the male employees hired since January 1, 2020:\n\n```\njson.get key $[?(@.HireDate>\"2020.00.00\"&&@.Gender==\"Male\")].ID\n[75,9]\n```\n\nThese examples provide only a small glimpse into the possibilities for the JSON datatype.\n\n### **Redis and JSON Performance**\n\nThe dataset above was chosen to make it easy to understand examples of the capabilities of paths and filter expressions. We need a larger dataset to get a view into the performance of JSON paths and filters. One of the commonly used datasets to benchmark JSON performance is in the file ```update-center.json``` (see [here](https://github.com/chadaustin/sajson/blob/master/testdata/update-center.json)). This file is 521KB in size.\n\nEach of the following performance tests was generated by running ```redis-benchmark``` on ten (10) client systems (```c5n.xlarge```), where each client system utilized ten (10) parallel connections for a total of 100 parallel connections. Each test was run on a single-node r6g cluster of ElastiCache for Redis. The test is repeated once for each reported instance size. All of the systems were in the same availability zone. The reported results are the average of the sum of the requests-per-second (rps) for the 100 connections.\n\nAs a baseline, we tested the performance of fetching an entire JSON document.\n\n![image.png](https://dev-media.amazoncloud.cn/259e6a14d79e447f902c54d5e2f3c67a_image.png)\n\nWith the baseline established, we then ran a test that fetched a single string identified by a path. Generally, the components of a path that select a specific element execute in O(1) time. This means that the performance is directly related to the network cost of transferring the selected data, independent of the total amount of JSON data in the Redis key. Here the selected data string is small, thus yielding correspondingly high throughput.\n\n![image.png](https://dev-media.amazoncloud.cn/08f2a613421046b2873a27332c27e147_image.png)\n\nThis next test builds on the last example. A single string of a JSON document is identified by a path and is updated to a new value. As with the read case, the cost of the path is O(1) and yields high throughput when combined with the small string size.\n\n![image.png](https://dev-media.amazoncloud.cn/40f7adc642c74ec0bcece3c8aa8024c1_image.png)\n\nThis next example tests query performance when using a filter. Because the data is primarily organized as an object, the recursive search operator (..) must be used. This operator is O(N) for the amount of data being searched. Here, the ```plugin``` object contains 654 members, and each of those members has between 15 and 20 members, resulting in the filter operation being applied more than 10K times with a corresponding effect on performance.\n\n![image.png](https://dev-media.amazoncloud.cn/03dafffa3fad437ab12ea6a303a6e831_image.png)\n\nHere’s the write/set performance of the previous example.\n\n![image.png](https://dev-media.amazoncloud.cn/2923bc1eb5c34a9bb1ce610c1059bd35_image.png)\n\nYou can optimize query performance when using filters by modifying the composition of your JSON documents. Specifically, when converting the ```plugin``` object into an array and using array search, the filter will be applied to only the 654 members and not recursively to the 15-20 members within each element (i.e., 10K times). This short Python program was used to convert the ```plugin``` object of the ```update-center.json``` file into an array. The output of this program was used for the following tests:\n\n```\nimport json\no = json.load(open('update-center.json'))\no['plugins'] = [v for v in o['plugins'].values()]\njson.dump(o, open('new-update-center.json','w'))\n```\n\nRepeating the same queries as above (modified to use the array search instead of the recursive search) yields approximately a 25x improvement to throughput.\n\n![image.png](https://dev-media.amazoncloud.cn/9c12aeba6cd04151bd6b5c001b5c31e4_image.png)\n\n![image.png](https://dev-media.amazoncloud.cn/a20295dedf19479eb6d4e07cecbfaa96_image.png)\n\nThis particular series of example tests was chosen to illustrate not only the power of JSON paths and filters, but also the sensitivity to the contents and structure of the data being used. Since your overall performance is a function both of the shape of your JSON data and the nature of the queries being performed, we recommend testing using a dataset with structure and content that mimics your production environment as closely as possible.\n\n### **Wrapping up**\n\nThe addition of JSON support inside ElastiCache and MemoryDB simplifies the development of applications as well as improves performance and reliability. Using the new JSON datatype simplifies or eliminates complicated and error-prone conversions required to use the other built-in Redis data types. Simplifying or eliminating these conversions can not only accelerate application development, but also improve application reliability. You can achieve higher performance by using the server-side processing capabilities to eliminate situations where multiple database requests would otherwise be required.\n\nTo get started, create a new cluster in the [ElastiCache console](https://console.aws.amazon.com/elasticache/home) or the [MemoryDB console](https://console.aws.amazon.com/memorydb/home), and take a look at additional examples and the command reference in our documentation ([ElastiCache](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/json-gs.html), [MemoryDB](https://docs.aws.amazon.com/memorydb/latest/devguide/json-gs.html)).\n\n#### **About the Authors**\n\n![image.png](https://dev-media.amazoncloud.cn/038a0b10380241bb84a73b452ae6d881_image.png)\n\n**Allen Samuels** is a Principal Engineer at Amazon Web Services. He is passionate about\ndistributed, performant systems. When not travelling the world for pleasure or playing duplicate bridge, Allen can be found in San Jose, California.\n\n![image.png](https://dev-media.amazoncloud.cn/fabcee8e1a3442749f6ee66c02833f18_image.png)\n\n**Joe Travaglini** leads Product Management for Amazon ElastiCache and Amazon MemoryDB and has spent the past 6 years in product roles at AWS. Prior to joining Amazon, he was Director of Products at Sqrrl, a cybersecurity analytics startup acquired by AWS. Other than helping customers get the most out of the cloud, Joe enjoys spending time with family, rooting for Boston sports teams, and practicing as an amateur/home chef.\n\n![image.png](https://dev-media.amazoncloud.cn/e3272351ca654fb493efa87b20a46757_image.png)\n\n**Joe Hu** is a Software Development Engineer in AWS In-Memory Databases team, based in Boston. He is passionate about building large scale distributed cloud services. He has spent the majority of his career in the areas of database internals, column store, replication, backup & restore, and distributed query processing. In his leisure time, Joe actively plays table tennis at local clubs and occasionally competes in regional tournaments.\n","render":"<p><a href=\"https://insights.stackoverflow.com/survey/2021#most-loved-dreaded-and-wanted-database-love-dread\" target=\"_blank\">Application developers love Redis</a> because it has a large and vibrant open source community, provides blazing-fast in-memory performance, and has a developer-friendly yet powerful API that provides native support for multiple data structures. These traits make Redis a great fit for building and running high-performance, scalable web applications.</p>\n<p>At AWS, we offer two fully-managed, Redis-based services: <a href=\"https://aws.amazon.com/cn/elasticache/redis/\" target=\"_blank\">Amazon ElastiCache for Redis</a> for caching and ephemeral data storage, and <a href=\"https://aws.amazon.com/cn/memorydb/\" target=\"_blank\">Amazon MemoryDB for Redis</a>, an in-memory primary database for applications that require a higher level of data durability. <a href=\"https://aws.amazon.com/cn/elasticache/redis/customers/\" target=\"_blank\">Our customers</a> use these services to accelerate performance for a wide range of use cases, from mobile payments to gaming leaderboards, Internet of Things (IoT) analytics, ride sharing, and real-time ad serving. They’ve chosen us because of our track record of operational stability and the price-performance enhancements that we’ve made, such as <a href=\"https://aws.amazon.com/cn/blogs/database/boosting-application-performance-and-reducing-costs-with-amazon-elasticache-for-redis/\" target=\"_blank\">Enhanced IO</a>, <a href=\"https://aws.amazon.com/cn/blogs/database/reduce-cost-and-boost-throughput-with-global-datastore-for-amazon-elasticache-for-redis/\" target=\"_blank\">multi-flow TCP</a>, and <a href=\"https://aws.amazon.com/cn/blogs/database/scale-your-amazon-elasticache-for-redis-clusters-at-a-lower-cost-with-data-tiering/\" target=\"_blank\">data tiering</a>.</p>\n<p>Today, we’re excited to announce that we’re unlocking even more power for Redis application developers by providing native support for JavaScript Object Notation (JSON) within ElastiCache and MemoryDB. JSON is a near ubiquitous way to encode and exchange data, and it’s now even simpler to store and access JSON documents inside ElastiCache and MemoryDB. This launch simplifies ElastiCache caching for our purpose-built document database, <a href=\"https://aws.amazon.com/cn/documentdb/\" target=\"_blank\">Amazon DocumentDB (with MongoDB compatibility)</a>, as well as working with durable JSON inside MemoryDB. JSON support is available in all ElastiCache and MemoryDB regions at no additional cost. To get started, simply create a new cluster using Redis version 6.2 or greater and you’ll have the new JSON data type and associated commands available.</p>\n<p>The rest of this post will cover how our JSON support works at a more technical level and provide examples of how you can write JSON documents, efficiently fetch or set portions of a JSON document in Redis, and search your JSON documents’ content using <a href=\"https://goessner.net/articles/JsonPath/\" target=\"_blank\">the Goessner-style</a> JSONPath query language.</p>\n<h3><a id=\"JSON_in_ElastiCache_and_MemoryDB_8\"></a><strong>JSON in ElastiCache and MemoryDB</strong></h3>\n<p>Although JSON is a standard serialization format for the interchange of structured data (RFC 8259, ECMA 404), JSON support in ElastiCache and MemoryDB provides much more than simple storage and retrieval of JSON-encoded data. It simplifies the development of applications that store complex data structures by providing powerful searching and filtering capabilities. As shown in the following section, many application operations on complex data structures that previously required substantial development time as well as multiple expensive network round-trips can be easily and naturally expressed in a single JSON command. This results in a dramatic improvement in developer productivity and system improvement, as well as reduction in operational costs.</p>\n<p>The new Redis JSON datatype offers six types of values, four primitive (null, boolean, number, and string), and two composite (object and array). The composites map either a string or a dense integer key to a value. However, unlike other Redis composites, JSON composites can contain any of the six value types in any combination, including other JSON composites, i.e., recursion. The ability to freely intermix these value types provides a natural way to represent nearly any structured data.</p>\n<p>Client applications use the serialized format to communicate with the service. However, internally the data is stored using a tree-like binary format for efficient traversal and manipulation. The tree-like format allows operations to be performed on sub-trees just as efficiently as when operating on an entire JSON key. In the following description, the term “element” will be used generically to indicate any JSON value, including when the value is just a primitive like a string or a number or when it’s a composite of other values.</p>\n<p>The JSON datatype is fully integrated into the Redis access control lists (ACL) capability. All JSON commands correctly enforce any keyspace or command restrictions or permissions. Just like the existing per-datatype categories (<code>@string</code>, <code>@hash</code>, etc.) a new category <code>@json</code> is added to simplify managing access to JSON commands and data.</p>\n<p>Most JSON commands accept not only a key, but also one or more paths. A path is an expression that identifies the element or elements of the JSON document within the key on which the command is to operate. The syntax and semantics of the path closely follow the original <a href=\"https://goessner.net/articles/JsonPath/\" target=\"_blank\">Goessner JSONPath proposal.</a> See <a href=\"https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/json-document-overview.html#json-path-syntax\" target=\"_blank\">our documentation</a> for more information about JSONPath.</p>\n<h3><a id=\"Redis_and_JSON_in_action_20\"></a><strong>Redis and JSON in action</strong></h3>\n<p>To illustrate some of the power of JSON data and JSON paths, let’s take a data structure, such as a list of employees, and see how some simple operations can be coded.</p>\n<p>We’ll represent the list of employees as an array of objects, one object for each employee. Our example data is as follows:</p>\n<pre><code class=\"lang-\">redis-cli --raw -x json.set key . << EOF\n[\n {\n "ID" : 21,\n "Name" : "Audrey", \n "Gender" : "Female",\n "HireDate" : "2020.07.31",\n "Building" : "F1"\n },\n {\n "ID" : 15,\n "Name" : "Bette", \n "Gender" : "Female",\n "HireDate" : "2021.01.31",\n "Building" : "F1"\n },\n {\n "ID" : 75,\n "Name" : "Craig", \n "Gender" : "Male",\n "HireDate" : "2022.02.15",\n "Building" : "F2"\n },\n {\n "ID" : 9,\n "Name" : "Dwayne", \n "Gender" : "Male",\n "HireDate" : "2020.10.02",\n "Building" : "F2"\n },\n {\n "ID" : 3,\n "Name" : "Edith", \n "Gender" : "Female",\n "HireDate" : "2018.08.22",\n "Building" : "F21"\n }\n]\nEOF\n</code></pre>\n<p>Fetching an employee object by an attribute like the “ID” field is simple:</p>\n<pre><code class=\"lang-\">json.get key $[?(@.ID==21)]\n[{"ID":21,"Name":"Audrey","Gender":"Female","HireDate":"2020.07.31","Building":"F1"}]\n</code></pre>\n<p>There’s no reason that the selection attribute can’t have multiple responses. Here the query returns the employee records of all of the employees located in building F2:</p>\n<pre><code class=\"lang-\">json.get key $[?(@.Building=="F2")]\n[{"ID":75,"Name":"Craig","Gender":"Male","HireDate":"2022.02.15","Building":"F2"},\n {"ID":9,"Name":"Dwayne","Gender":"Male","HireDate":"2020.10.02","Building":"F2"}]\n</code></pre>\n<p>But, you don’t have to fetch entire employee records, you can pick a field like ID to be returned. This query returns the ID of all of the female employees:</p>\n<pre><code class=\"lang-\">json.get key $[?(@.Gender=="Female")].ID\n[21,15,3]\n</code></pre>\n<p>Even though JSON doesn’t have a dedicated primitive for timestamps, you can use strings to represent them. This query returns all of the employees hired since January 1, 2020:</p>\n<pre><code class=\"lang-\">json.get key $[?(@.HireDate>"2020.00.00")].ID\n[21,15,75,9]\n</code></pre>\n<p>Query filters aren’t limited to a single field, and you can combine multiple filters. This query finds all of the male employees hired since January 1, 2020:</p>\n<pre><code class=\"lang-\">json.get key $[?(@.HireDate>"2020.00.00"&&@.Gender=="Male")].ID\n[75,9]\n</code></pre>\n<p>These examples provide only a small glimpse into the possibilities for the JSON datatype.</p>\n<h3><a id=\"Redis_and_JSON_Performance_105\"></a><strong>Redis and JSON Performance</strong></h3>\n<p>The dataset above was chosen to make it easy to understand examples of the capabilities of paths and filter expressions. We need a larger dataset to get a view into the performance of JSON paths and filters. One of the commonly used datasets to benchmark JSON performance is in the file <code>update-center.json</code> (see <a href=\"https://github.com/chadaustin/sajson/blob/master/testdata/update-center.json\" target=\"_blank\">here</a>). This file is 521KB in size.</p>\n<p>Each of the following performance tests was generated by running <code>redis-benchmark</code> on ten (10) client systems (<code>c5n.xlarge</code>), where each client system utilized ten (10) parallel connections for a total of 100 parallel connections. Each test was run on a single-node r6g cluster of ElastiCache for Redis. The test is repeated once for each reported instance size. All of the systems were in the same availability zone. The reported results are the average of the sum of the requests-per-second (rps) for the 100 connections.</p>\n<p>As a baseline, we tested the performance of fetching an entire JSON document.</p>\n<p><img src=\"https://dev-media.amazoncloud.cn/259e6a14d79e447f902c54d5e2f3c67a_image.png\" alt=\"image.png\" /></p>\n<p>With the baseline established, we then ran a test that fetched a single string identified by a path. Generally, the components of a path that select a specific element execute in O(1) time. This means that the performance is directly related to the network cost of transferring the selected data, independent of the total amount of JSON data in the Redis key. Here the selected data string is small, thus yielding correspondingly high throughput.</p>\n<p><img src=\"https://dev-media.amazoncloud.cn/08f2a613421046b2873a27332c27e147_image.png\" alt=\"image.png\" /></p>\n<p>This next test builds on the last example. A single string of a JSON document is identified by a path and is updated to a new value. As with the read case, the cost of the path is O(1) and yields high throughput when combined with the small string size.</p>\n<p><img src=\"https://dev-media.amazoncloud.cn/40f7adc642c74ec0bcece3c8aa8024c1_image.png\" alt=\"image.png\" /></p>\n<p>This next example tests query performance when using a filter. Because the data is primarily organized as an object, the recursive search operator (…) must be used. This operator is O(N) for the amount of data being searched. Here, the <code>plugin</code> object contains 654 members, and each of those members has between 15 and 20 members, resulting in the filter operation being applied more than 10K times with a corresponding effect on performance.</p>\n<p><img src=\"https://dev-media.amazoncloud.cn/03dafffa3fad437ab12ea6a303a6e831_image.png\" alt=\"image.png\" /></p>\n<p>Here’s the write/set performance of the previous example.</p>\n<p><img src=\"https://dev-media.amazoncloud.cn/2923bc1eb5c34a9bb1ce610c1059bd35_image.png\" alt=\"image.png\" /></p>\n<p>You can optimize query performance when using filters by modifying the composition of your JSON documents. Specifically, when converting the <code>plugin</code> object into an array and using array search, the filter will be applied to only the 654 members and not recursively to the 15-20 members within each element (i.e., 10K times). This short Python program was used to convert the <code>plugin</code> object of the <code>update-center.json</code> file into an array. The output of this program was used for the following tests:</p>\n<pre><code class=\"lang-\">import json\no = json.load(open('update-center.json'))\no['plugins'] = [v for v in o['plugins'].values()]\njson.dump(o, open('new-update-center.json','w'))\n</code></pre>\n<p>Repeating the same queries as above (modified to use the array search instead of the recursive search) yields approximately a 25x improvement to throughput.</p>\n<p><img src=\"https://dev-media.amazoncloud.cn/9c12aeba6cd04151bd6b5c001b5c31e4_image.png\" alt=\"image.png\" /></p>\n<p><img src=\"https://dev-media.amazoncloud.cn/a20295dedf19479eb6d4e07cecbfaa96_image.png\" alt=\"image.png\" /></p>\n<p>This particular series of example tests was chosen to illustrate not only the power of JSON paths and filters, but also the sensitivity to the contents and structure of the data being used. Since your overall performance is a function both of the shape of your JSON data and the nature of the queries being performed, we recommend testing using a dataset with structure and content that mimics your production environment as closely as possible.</p>\n<h3><a id=\"Wrapping_up_148\"></a><strong>Wrapping up</strong></h3>\n<p>The addition of JSON support inside ElastiCache and MemoryDB simplifies the development of applications as well as improves performance and reliability. Using the new JSON datatype simplifies or eliminates complicated and error-prone conversions required to use the other built-in Redis data types. Simplifying or eliminating these conversions can not only accelerate application development, but also improve application reliability. You can achieve higher performance by using the server-side processing capabilities to eliminate situations where multiple database requests would otherwise be required.</p>\n<p>To get started, create a new cluster in the <a href=\"https://console.aws.amazon.com/elasticache/home\" target=\"_blank\">ElastiCache console</a> or the <a href=\"https://console.aws.amazon.com/memorydb/home\" target=\"_blank\">MemoryDB console</a>, and take a look at additional examples and the command reference in our documentation (<a href=\"https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/json-gs.html\" target=\"_blank\">ElastiCache</a>, <a href=\"https://docs.aws.amazon.com/memorydb/latest/devguide/json-gs.html\" target=\"_blank\">MemoryDB</a>).</p>\n<h4><a id=\"About_the_Authors_154\"></a><strong>About the Authors</strong></h4>\n<p><img src=\"https://dev-media.amazoncloud.cn/038a0b10380241bb84a73b452ae6d881_image.png\" alt=\"image.png\" /></p>\n<p><strong>Allen Samuels</strong> is a Principal Engineer at Amazon Web Services. He is passionate about<br />\ndistributed, performant systems. When not travelling the world for pleasure or playing duplicate bridge, Allen can be found in San Jose, California.</p>\n<p><img src=\"https://dev-media.amazoncloud.cn/fabcee8e1a3442749f6ee66c02833f18_image.png\" alt=\"image.png\" /></p>\n<p><strong>Joe Travaglini</strong> leads Product Management for Amazon ElastiCache and Amazon MemoryDB and has spent the past 6 years in product roles at AWS. Prior to joining Amazon, he was Director of Products at Sqrrl, a cybersecurity analytics startup acquired by AWS. Other than helping customers get the most out of the cloud, Joe enjoys spending time with family, rooting for Boston sports teams, and practicing as an amateur/home chef.</p>\n<p><img src=\"https://dev-media.amazoncloud.cn/e3272351ca654fb493efa87b20a46757_image.png\" alt=\"image.png\" /></p>\n<p><strong>Joe Hu</strong> is a Software Development Engineer in AWS In-Memory Databases team, based in Boston. He is passionate about building large scale distributed cloud services. He has spent the majority of his career in the areas of database internals, column store, replication, backup & restore, and distributed query processing. In his leisure time, Joe actively plays table tennis at local clubs and occasionally competes in regional tournaments.</p>\n"}