{"id":278,"date":"2021-08-31T14:40:23","date_gmt":"2021-08-31T14:40:23","guid":{"rendered":"https:\/\/fde.cat\/?p=278"},"modified":"2021-08-31T14:40:23","modified_gmt":"2021-08-31T14:40:23","slug":"a-peek-at-datoramas-virtual-sandbox","status":"publish","type":"post","link":"https:\/\/fde.cat\/index.php\/2021\/08\/31\/a-peek-at-datoramas-virtual-sandbox\/","title":{"rendered":"A Peek at Datorama\u2019s Virtual Sandbox"},"content":{"rendered":"<figure><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1000\/1*utYjlz8P-St5PhOLNK_CyA.png?w=750&#038;ssl=1\" data-recalc-dims=\"1\"><\/figure>\n<h4>What is a\u00a0Sandbox?<\/h4>\n<p>A Sandbox is an isolated environment where you can safely experiment and test changes that you intend to apply to your live environment. The idea is to learn about the implications of these intended changes in advance, in order to decide on how to best conduct them, without actually causing any harm to the live environment in the\u00a0process.<\/p>\n<h4>How is This Usually Addressed?<\/h4>\n<p>The way in which most companies solve the sandbox requirement is by copying the live environment onto a completely separate environment. Testing and experimenting then takes place on the copied environment, with no impact on the live one. This approach has a few drawbacks:<\/p>\n<ol>\n<li>Copying the data from one environment to another, along with the entire configuration, is a very time consuming process.<\/li>\n<li>While working on your sandbox environment, your live environment gets constantly updated with new data and configuration changes. This means that within time, the sandbox environment will no longer truly represent the production environment.<\/li>\n<li>In most cases, the data is only partially copied from the live environment to the sandbox. This data deficiency in the sandbox makes it impossible to truly appreciate the full implications of your sandbox\u00a0actions.<\/li>\n<\/ol>\n<h4>How is Sandbox for Datorama Different?<\/h4>\n<p>Rather than having two separate environments, our solution is based on having two separate <em>modes<\/em>, a sandbox mode and a production mode, within the same environment, where changes made in the sandbox mode have zero impact on the production mode. Having the two modes in the same environment eliminates the need to copy data from one environment to another, meaning the data is never partial and the setup process is always instantaneous. Furthermore, the two modes never differ with the passage of time. They are both perfectly aligned, 100% of the time. The way in which we were able to achieve this is by making the distinction between sandbox and production <strong>right down to the entity level<\/strong>, rather than the environment level. So, any given list of entities, be it dashboards, reports, pages, data streams, etc., is identified as either being production or sandbox entities:<\/p>\n<figure><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn-images-1.medium.com\/max\/287\/0*hPreRbJhS7bF0II8\"><\/figure>\n<p>From there, we just make sure that the right entities are accessible from the relevant environment. So, within production, only the production entities are accessible, since all of the Sandbox entities are filtered out. This means that anything you do within the sandbox has no impact on production whatsoever. Within the sandbox environment, you have both production and sandbox entities. This is because, in addition to adding new sandbox entities, you may also want to edit existing production ones to see how they interact:<\/p>\n<figure><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1024\/0*7op3sicfUJBJspgG\"><\/figure>\n<h4>The Data Stream Entity\u200a\u2014\u200aLoading &amp; Querying sandbox\u00a0data<\/h4>\n<p>In order to explain Data Querying in sandbox mode, we will examine one of the main entities a customer has on their workspace\u200a\u2014\u200aData\u00a0Stream.<\/p>\n<p>A data stream is the configuration entity that is responsible for the data ETL process. It is responsible for pushing\/pulling data from the different data providers, transforming the data according to the user definition, and loading it to the Datorama data warehouse.<\/p>\n<p>To allow differentiating between the different streams data, the Data Stream ID is part of every row of\u00a0data.<\/p>\n<p>When the user edits a Data Stream in sandbox mode, what actually happens behind the scenes is that a new data stream is created with a different ID, and the relevant data is re-loaded to the data warehouse with this new ID; all of this is hidden from the\u00a0user.<\/p>\n<p>Having both sets of data (Production and Sandbox) reside next to each other in the database with the knowledge of the \u201creplace data\u201d relation between the 2 entities allows us to manipulate the DB query and filter in and out the desired data according to the user\u2019s sandbox\/production mode.<\/p>\n<p>For example in Sandbox Mode, the query will filter\u00a0out:<\/p>\n<ul>\n<li>Data Stream that was deleted in\u00a0Sandbox<\/li>\n<li>The data of an origin data stream which was edited in Sandbox (i.e filter out the production stream and include the sandbox stream which replace\u00a0it)<\/li>\n<\/ul>\n<p>In Production Mode, the Query will filter out all Sandbox data stream\u2019s\u00a0data.<\/p>\n<h4>Example of Querying Data in Production Mode Vs Sandbox\u00a0Mode<\/h4>\n<ul>\n<li>The data stream table shows all the stream configuration<\/li>\n<li>The Sandbox Entity Table describes the relationship between the Sandbox entity and its \u201cSibling\u201d Production streams. In this example, the Query will replace the production stream data with its Sibling sandbox stream\u00a0data.<\/li>\n<li>DW is the data warehouse where both sets of data (production &amp; sandbox)\u00a0reside.<\/li>\n<\/ul>\n<figure><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1024\/0*cBzlFgBoWbWtp2dr\"><\/figure>\n<h4>Sandbox Entity Management<\/h4>\n<p>There are three main operations a user can perform on entities when working in their virtual\u00a0sandbox:<\/p>\n<ul>\n<li>Adding an entity that does not yet exist in production<\/li>\n<li>Editing an existing production entity<\/li>\n<li>Deleting an existing production entity.<\/li>\n<\/ul>\n<p>To allow managing sandbox entities, we use a new DB Table and a common infrastructure that allows registering sandbox operations.<\/p>\n<p>For example, when a production entity is edited in sandbox mode, an additional record is added to the database schema; this record describes that Entity \u2018123\u2019 should be replaced with Entity \u2018456\u2019 in sandbox\u00a0mode.<\/p>\n<figure><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1024\/0*eevnnZZT2uY8t-OV\"><\/figure>\n<p>Another example is when a new entity that does not exist in production is added in the\u00a0sandbox.<\/p>\n<figure><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1024\/0*jWeyVpjmGtmY4Qpk\"><\/figure>\n<h4>Switching Between Sandbox &amp; Production Views<\/h4>\n<p>When a user selects to switch from production to sandbox view, what actually happens behind the scenes is that an API on the server that registers this action is invoked and responds with a unique sandbox\u00a0token.<\/p>\n<p>This sandbox token is saved on the user\u2019s browser session. From this point of time, all the requests sent from the client are intercepted and the sandbox token is added to the\u00a0request.<\/p>\n<figure><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1024\/0*CO5iiXF662c4C20w\"><\/figure>\n<p>The above sandbox token that indicates the mode is propagated through the method call stack and allows the server to decide which way to create or update entries configuration and which data to retrieve from\u00a0storage.<\/p>\n<h4>Conclusion<\/h4>\n<p>The new approach Datorama took with the Virtual Sandbox created huge benefits for Datorama customers, allowing them to create a Sandbox environment that includes all of their production data in one click and with zero duration. And, more than that, this sandbox environment is continually updated with the latest production changes.<\/p>\n<p>From the engineering side, this approach eliminated the need to transfer huge amounts of data from the production environment to the sandbox environment and dramatically reduced the processing and storage\u00a0needed.<\/p>\n<figure><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn-images-1.medium.com\/max\/486\/0*CEVbWz8ZOVhbcPmM\"><\/figure>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/medium.com\/_\/stat?event=post.clientViewed&amp;referrerSource=full_rss&amp;postId=ae08c8927c19\" width=\"1\" height=\"1\" alt=\"\"><\/p>\n<hr>\n<p><a href=\"https:\/\/engineering.salesforce.com\/a-peek-at-datoramas-virtual-sandbox-ae08c8927c19\">A Peek at Datorama\u2019s Virtual Sandbox<\/a> was originally published in <a href=\"https:\/\/engineering.salesforce.com\/\">Salesforce Engineering<\/a> on Medium, where people are continuing the conversation by highlighting and responding to this story.<\/p>\n<p><a href=\"https:\/\/engineering.salesforce.com\/a-peek-at-datoramas-virtual-sandbox-ae08c8927c19?source=rss----cfe1120185d3---4\" target=\"_blank\" rel=\"noopener\">Read More<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is a\u00a0Sandbox? A Sandbox is an isolated environment where you can safely experiment and test changes that you intend to apply to your live environment. The idea is to learn about the implications of these intended changes in advance, in order to decide on how to best conduct them, without actually causing any harm&hellip; <a class=\"more-link\" href=\"https:\/\/fde.cat\/index.php\/2021\/08\/31\/a-peek-at-datoramas-virtual-sandbox\/\">Continue reading <span class=\"screen-reader-text\">A Peek at Datorama\u2019s Virtual Sandbox<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-278","post","type-post","status-publish","format-standard","hentry","category-technology","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":625,"url":"https:\/\/fde.cat\/index.php\/2022\/08\/30\/hyperpacks-using-buildpacks-to-build-hyperforce\/","url_meta":{"origin":278,"position":0},"title":"Hyperpacks: Using Buildpacks to Build Hyperforce","date":"August 30, 2022","format":false,"excerpt":"At Salesforce we regularly use our products and services to scale our own business. One example is Buildpacks, which we created nearly a decade ago and is now a part of Hyperforce. Hyperpacks are an innovative new way of using Cloud Native Buildpacks (CNB) to manage our public cloud infrastructure.\u00a0\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":896,"url":"https:\/\/fde.cat\/index.php\/2024\/07\/16\/the-unstructured-data-dilemma-how-data-cloud-handles-250-trillion-transactions-weekly\/","url_meta":{"origin":278,"position":1},"title":"The Unstructured Data Dilemma: How Data Cloud Handles 250 Trillion Transactions Weekly","date":"July 16, 2024","format":false,"excerpt":"In our \u201cEngineering Energizers\u201d Q&A series, we delve into the journeys of engineering leaders who have made notable strides in their areas of expertise. This edition features Adithya Vishwanath, Vice President of Software Engineering at Salesforce. He leads the Data Cloud team, a pivotal platform that integrates diverse data sources,\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":688,"url":"https:\/\/fde.cat\/index.php\/2023\/03\/07\/automated-environment-build-salesforces-secret-sauce-for-rapid-cloud-expansion\/","url_meta":{"origin":278,"position":2},"title":"Automated Environment Build: Salesforce\u2019s Secret Sauce for Rapid Cloud Expansion","date":"March 7, 2023","format":false,"excerpt":"Around the world, companies must satisfy global compliance regulations or face pricey fines, where failure to comply results in 2.71 higher costs than the cost to comply. For example, Fortune 500 companies are projected to lose $8 billion per year as a result of GDPR non-compliance. In response, Salesforce created\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":224,"url":"https:\/\/fde.cat\/index.php\/2021\/02\/02\/building-a-secured-data-intelligence-platform\/","url_meta":{"origin":278,"position":3},"title":"Building a Secured Data Intelligence Platform","date":"February 2, 2021","format":false,"excerpt":"The Salesforce Unified Intelligence Platform (UIP) team is building a shared, central, internal data intelligence platform. Designed to drive business insights, UIP helps improve user experience, product quality, and operations. At Salesforce, Trust is our number one company value and building in robust security is a key component of our\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":502,"url":"https:\/\/fde.cat\/index.php\/2021\/11\/10\/ferret%e2%80%8a-%e2%80%8ayour-local-environment-made-easy\/","url_meta":{"origin":278,"position":4},"title":"Ferret\u200a\u2014\u200aYour local Environment made Easy","date":"November 10, 2021","format":false,"excerpt":"Ferret\u200a\u2014\u200aYour local Environment Made\u00a0Easy What\u2019s the first thing you do when you get a new laptop? For many engineers, it\u2019s setting up a good development environment, which is key for developing and troubleshooting effectively. Running a local environment helps to speed up the development process as well as improve collaboration.\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":493,"url":"https:\/\/fde.cat\/index.php\/2021\/10\/20\/autonomous-testing-of-services-at-scale\/","url_meta":{"origin":278,"position":5},"title":"Autonomous testing of services at scale","date":"October 20, 2021","format":false,"excerpt":"Enabling developers to prototype, test, and iterate on new features quickly is important to Facebook\u2019s success. To do this effectively, it\u2019s key to have a stable infrastructure that doesn\u2019t introduce unnecessary friction. This gets significantly more challenging when the infrastructure in question must also scale to support more than 3\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/posts\/278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/comments?post=278"}],"version-history":[{"count":1,"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/posts\/278\/revisions"}],"predecessor-version":[{"id":432,"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/posts\/278\/revisions\/432"}],"wp:attachment":[{"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/media?parent=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/categories?post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fde.cat\/index.php\/wp-json\/wp\/v2\/tags?post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}