
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Sat, 04 Apr 2026 18:09:11 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Getting to the Core: Benchmarking Cloudflare’s Latest Server Hardware]]></title>
            <link>https://blog.cloudflare.com/getting-to-the-core/</link>
            <pubDate>Fri, 20 Nov 2020 12:00:00 GMT</pubDate>
            <description><![CDATA[ A refresh of the hardware that Cloudflare uses to run analytics provided big efficiency improvements. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Maintaining a server fleet the size of Cloudflare’s is an operational challenge, to say the least. Anything we can do to lower complexity and improve efficiency has effects for our SRE (Site Reliability Engineer) and Data Center teams that can be felt throughout a server’s 4+ year lifespan.</p><p>At the Cloudflare Core, we process logs to analyze attacks and compute analytics. In 2020, our Core servers were in need of a refresh, so we decided to redesign the hardware to be more in line with our Gen X edge servers. We designed two major server variants for the core. The first is Core Compute 2020, an AMD-based server for analytics and general-purpose compute paired with solid-state storage drives. The second is Core Storage 2020, an Intel-based server with twelve spinning disks to run database workloads.</p>
    <div>
      <h2>Core Compute 2020</h2>
      <a href="#core-compute-2020">
        
      </a>
    </div>
    <p>Earlier this year, we blogged about our 10th generation edge servers or Gen X and the <a href="/technical-details-of-why-cloudflare-chose-amd-epyc-for-gen-x-servers/">improvements</a> they delivered to our edge in <a href="/an-epyc-trip-to-rome-amd-is-cloudflares-10th-generation-edge-server-cpu/">both</a> performance and <a href="/securing-memory-at-epyc-scale/">security</a>. The new Core Compute 2020 server leverages many of our learnings from the edge server. The Core Compute servers run a variety of workloads including Kubernetes, Kafka, and various smaller services.</p>
    <div>
      <h3>Configuration Changes (Kubernetes)</h3>
      <a href="#configuration-changes-kubernetes">
        
      </a>
    </div>
    <table><tr><td><p>
</p></td><td><p><b>Previous Generation Compute</b></p></td><td><p><b>Core Compute 2020</b></p></td></tr><tr><td><p>CPU</p></td><td><p>2 x Intel Xeon Gold 6262</p></td><td><p>1 x AMD EPYC 7642</p></td></tr><tr><td><p>Total Core / Thread Count</p></td><td><p>48C / 96T</p></td><td><p>48C / 96T</p></td></tr><tr><td><p>Base / Turbo Frequency</p></td><td><p>1.9 / 3.6 GHz</p></td><td><p>2.3 / 3.3 GHz</p></td></tr><tr><td><p>Memory</p></td><td><p>8 x 32GB DDR4-2666</p></td><td><p>8 x 32GB DDR4-2933</p></td></tr><tr><td><p>Storage</p></td><td><p>6 x 480GB SATA SSD</p></td><td><p>2 x 3.84TB NVMe SSD</p></td></tr><tr><td><p>Network</p></td><td><p>Mellanox CX4 Lx 2 x 25GbE</p></td><td><p>Mellanox CX4 Lx 2 x 25GbE</p></td></tr></table><p><b>Configuration Changes (Kafka)</b></p><table><tr><td><p>
</p></td><td><p><b>Previous Generation (Kafka)</b></p></td><td><p><b>Core Compute 2020</b></p></td></tr><tr><td><p>CPU</p></td><td><p>2 x Intel Xeon Silver 4116</p></td><td><p>1 x AMD EPYC 7642</p></td></tr><tr><td><p>Total Core / Thread Count</p></td><td><p>24C / 48T</p></td><td><p>48C / 96T</p></td></tr><tr><td><p>Base / Turbo Frequency</p></td><td><p>2.1 / 3.0 GHz</p></td><td><p>2.3 / 3.3 GHz</p></td></tr><tr><td><p>Memory</p></td><td><p>6 x 32GB DDR4-2400</p></td><td><p>8 x 32GB DDR4-2933</p></td></tr><tr><td><p>Storage</p></td><td><p>12 x 1.92TB SATA SSD</p></td><td><p>10 x 3.84TB NVMe SSD</p></td></tr><tr><td><p>Network</p></td><td><p>Mellanox CX4 Lx 2 x 25GbE</p></td><td><p>Mellanox CX4 Lx 2 x 25GbE</p></td></tr></table><p>Both previous generation servers were Intel-based platforms, with the Kubernetes server based on Xeon 6262 processors, and the Kafka server based on Xeon 4116 processors. One goal with these refreshed versions was to converge the configurations in order to simplify spare parts and firmware management across the fleet.</p><p>As the above tables show, the configurations have been converged with the only difference being the number of NVMe drives installed depending on the workload running on the host. In both cases we moved from a dual-socket configuration to a single-socket configuration, and the number of cores and threads per server either increased or stayed the same. In all cases, the base frequency of those cores was significantly improved. We also moved from SATA SSDs to NVMe SSDs.</p>
    <div>
      <h3>Core Compute 2020 Synthetic Benchmarking</h3>
      <a href="#core-compute-2020-synthetic-benchmarking">
        
      </a>
    </div>
    <p>The heaviest user of the SSDs was determined to be Kafka. The majority of the time Kafka is sequentially writing 2MB blocks to the disk. We created a simple FIO script with 75% sequential write and 25% sequential read, scaling the block size from a standard page table entry size of 4096B to Kafka’s write size of 2MB. The results aligned with what we expected from an NVMe-based drive.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6gqCJeXAL1sUcfVmBW3tVx/7b8a3a9a233086a321967ebb20878434/image5-5.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6jvSoQBw4BnPCkDYGyeqBH/b2c0a79f10afbdd73ee73d2545f5700f/image4-9.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1N6j9iEmdVaGiomZaoT1wH/cea3efb6d4781f8c0856743869feeb39/image3-8.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3KfgNVcwPiNMcb9Gv3T2KU/74c8932b2f69bacfa32754c4c7c1e2d8/image6-5.png" />
            
            </figure>
    <div>
      <h3>Core Compute 2020 Production Benchmarking</h3>
      <a href="#core-compute-2020-production-benchmarking">
        
      </a>
    </div>
    <p>Cloudflare runs many of our Core Compute services in Kubernetes containers, some of which are multi-core. By transitioning to a single socket, problems associated with dual sockets were eliminated, and we are guaranteed to have all cores allocated for any given container on the same socket.</p><p>Another heavy workload that is constantly running on Compute hosts is the Cloudflare <a href="/the-csam-scanning-tool/">CSAM Scanning Tool</a>. Our Systems Engineering team isolated a Compute 2020 compute host and the previous generation compute host, had them run just this workload, and measured the time to compare the fuzzy hashes for images to the NCMEC hash lists and verify that they are a “miss”.</p><p>Because the CSAM Scanning Tool is very compute intensive we specifically isolated it to take a look at its performance with the new hardware. We’ve spent a great deal of effort on software optimization and improved algorithms for this tool but investing in faster, better hardware is also important.</p><p>In these heatmaps, the X axis represents time, and the Y axis represents “buckets” of time taken to verify that it is not a match to one of the NCMEC hash lists. For a given time slice in the heatmap, the red point is the bucket with the most times measured, the yellow point the second most, and the green points the least. The red points on the Compute 2020 graph are all in the 5 to 8 millisecond bucket, while the red points on the previous Gen heatmap are all in the 8 to 13 millisecond bucket, which shows that on average, the Compute 2020 host is verifying hashes significantly faster.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6JYLpJjG9bAUuQLyeC2kyH/9168b62067b8776a7521e7d831472f74/image2-10.png" />
            
            </figure>
    <div>
      <h2>Core Storage 2020</h2>
      <a href="#core-storage-2020">
        
      </a>
    </div>
    <p>Another major workload we identified was <a href="/clickhouse-capacity-estimation-framework/">ClickHouse</a>, which performs analytics over large datasets. The last time we upgraded our servers running ClickHouse was back in <a href="/http-analytics-for-6m-requests-per-second-using-clickhouse/">2018</a>.</p>
    <div>
      <h3>Configuration Changes</h3>
      <a href="#configuration-changes">
        
      </a>
    </div>
    <table><tr><td><p>
</p></td><td><p><b>Previous Generation</b></p></td><td><p><b>Core Storage 2020</b></p></td></tr><tr><td><p>CPU</p></td><td><p>2 x Intel Xeon E5-2630 v4</p></td><td><p>1 x Intel Xeon Gold 6210U</p></td></tr><tr><td><p>Total Core / Thread Count</p></td><td><p>20C / 40T</p></td><td><p>20C / 40T</p></td></tr><tr><td><p>Base / Turbo Frequency</p></td><td><p>2.2 / 3.1 GHz</p></td><td><p>2.5 / 3.9 GHz</p></td></tr><tr><td><p>Memory</p></td><td><p>8 x 32GB DDR4-2400</p></td><td><p>8 x 32GB DDR4-2933</p></td></tr><tr><td><p>Storage</p></td><td><p>12 x 10TB 7200 RPM 3.5” SATA</p></td><td><p>12 x 10TB 7200 RPM 3.5” SATA</p></td></tr><tr><td><p>Network</p></td><td><p>Mellanox CX4 Lx 2 x 25GbE</p></td><td><p>Mellanox CX4 Lx 2 x 25GbE</p></td></tr></table><p><b>CPU Changes</b></p><p>For ClickHouse, we use a 1U chassis with 12 x 10TB 3.5” hard drives. At the time we were designing Core Storage 2020 our server vendor did not yet have an AMD version of this chassis, so we remained on Intel. However, we moved Core Storage 2020 to a single 20 core / 40 thread Xeon processor, rather than the previous generation’s dual-socket 10 core / 20 thread processors. By moving to the single-socket Xeon 6210U processor, we were able to keep the same core count, but gained 17% higher base frequency and 26% higher max turbo frequency. Meanwhile, the total CPU thermal design profile (TDP), which is an approximation of the maximum power the CPU can draw, went down from 165W to 150W.</p><p>On a dual-socket server, remote memory accesses, which are memory accesses by a process on socket 0 to memory attached to socket 1, incur a latency penalty, as seen in this table:</p><table><tr><td><p>
</p></td><td><p><b>Previous Generation</b></p></td><td><p><b>Core Storage 2020</b></p></td></tr><tr><td><p>Memory latency, socket 0 to socket 0</p></td><td><p>81.3 ns</p></td><td><p>86.9 ns</p></td></tr><tr><td><p>Memory latency, socket 0 to socket 1</p></td><td><p>142.6 ns</p></td><td><p>N/A</p></td></tr></table><p>An additional advantage of having a CPU with all 20 cores on the same socket is the elimination of these remote memory accesses, which take 76% longer than local memory accesses.</p>
    <div>
      <h3>Memory Changes</h3>
      <a href="#memory-changes">
        
      </a>
    </div>
    <p>The memory in the Core Storage 2020 host is rated for operation at 2933 MHz; however, in the 8 x 32GB configuration we need on these hosts, the Intel Xeon 6210U processor clocks them at 2666 MH. Compared to the previous generation, this gives us a 13% boost in memory speed. While we would get a slightly higher clock speed with a balanced, 6 DIMMs configuration, we determined that we are willing to sacrifice the slightly higher clock speed in order to have the additional RAM capacity provided by the 8 x 32GB configuration.</p>
    <div>
      <h3>Storage Changes</h3>
      <a href="#storage-changes">
        
      </a>
    </div>
    <p>Data capacity stayed the same, with 12 x 10TB SATA drives in RAID 0 configuration for best  throughput. Unlike the previous generation, the drives in the Core Storage 2020 host are helium filled. Helium produces less drag than air, resulting in potentially lower latency.</p>
    <div>
      <h3>Core Storage 2020 Synthetic benchmarking</h3>
      <a href="#core-storage-2020-synthetic-benchmarking">
        
      </a>
    </div>
    <p>We performed synthetic four corners benchmarking: IOPS measurements of random reads and writes using 4k block size, and bandwidth measurements of sequential reads and writes using 128k block size. We used the fio tool to see what improvements we would get in a lab environment. The results show a 10% latency improvement and 11% IOPS improvement in random read performance. Random write testing shows 38% lower latency and 60% higher IOPS. Write throughput is improved by 23%, and read throughput is improved by a whopping 90%.</p><p></p><table><tr><td><p>
</p></td><td><p><b>Previous Generation</b></p></td><td><p><b>Core Storage 2020</b></p></td><td><p><b>% Improvement</b></p></td></tr><tr><td><p>4k Random Reads (IOPS)</p></td><td><p>3,384</p></td><td><p>3,758</p></td><td><p>11.0%</p></td></tr><tr><td><p>4k Random Read Mean Latency (ms, lower is better)</p></td><td><p>75.4</p></td><td><p>67.8</p></td><td><p>10.1% lower</p></td></tr><tr><td><p>4k Random Writes (IOPS)</p></td><td><p>4,009</p></td><td><p>6,397</p></td><td><p>59.6%</p></td></tr><tr><td><p>4k Random Write Mean Latency (ms, lower is better)</p></td><td><p>63.5</p></td><td><p>39.7</p></td><td><p>37.5% lower</p></td></tr><tr><td><p>128k Sequential Reads (MB/s)</p></td><td><p>1,155</p></td><td><p>2,195</p></td><td><p>90.0%</p></td></tr><tr><td><p>128k Sequential Writes (MB/s)</p></td><td><p>1,265</p></td><td><p>1,558</p></td><td><p>23.2%</p></td></tr></table>
    <div>
      <h3>CPU frequencies</h3>
      <a href="#cpu-frequencies">
        
      </a>
    </div>
    <p>The higher base and turbo frequencies of the Core Storage 2020 host’s Xeon 6210U processor allowed that processor to achieve higher average frequencies while running our production ClickHouse workload. A recent snapshot of two production hosts showed the Core Storage 2020 host being able to sustain an average of 31% higher CPU frequency while running ClickHouse.</p><table><tr><td><p>
</p></td><td><p><b>Previous generation (average core frequency)</b></p></td><td><p><b>Core Storage 2020 (average core frequency)</b></p></td><td><p><b>% improvement</b></p></td></tr><tr><td><p>Mean Core Frequency</p></td><td><p>2441 MHz</p></td><td><p>3199 MHz</p></td><td><p>31%</p></td></tr></table>
    <div>
      <h3>Core Storage 2020 Production benchmarking</h3>
      <a href="#core-storage-2020-production-benchmarking">
        
      </a>
    </div>
    <p>Our ClickHouse database hosts are continually performing merge operations to optimize the database data structures. Each individual merge operation takes just a few seconds on average, but since they’re constantly running, they can consume significant resources on the host. We sampled the average merge time every five minutes over seven days, and then sampled the data to find the average, minimum, and maximum merge times reported by a Compute 2020 host and by a previous generation host. Results are summarized below.</p>
    <div>
      <h3>ClickHouse merge operation performance improvement</h3>
      <a href="#clickhouse-merge-operation-performance-improvement">
        
      </a>
    </div>
    <table><tr><td><p><b>Time</b></p></td><td><p><b>Previous generation</b></p></td><td><p><b>Core Storage 2020</b></p></td><td><p><b>% improvement</b></p></td></tr><tr><td><p>Mean time to merge</p></td><td><p>1.83</p></td><td><p>1.15</p></td><td><p>37% lower</p></td></tr><tr><td><p>Maximum merge time</p></td><td><p>3.51</p></td><td><p>2.35</p></td><td><p>33% lower</p></td></tr><tr><td><p>Minimum merge time</p></td><td><p>0.68</p></td><td><p>0.32</p></td><td><p>53% lower</p></td></tr></table><p>Our lab-measured CPU frequency and storage performance improvements on Core Storage 2020 have translated into significantly reduced times to perform this database operation.</p>
    <div>
      <h2>Conclusion</h2>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>With our Core 2020 servers, we were able to realize significant performance improvements, both in synthetic benchmarking outside production and in the production workloads we tested. This will allow Cloudflare to run the same workloads on fewer servers, saving CapEx costs and data center rack space. The similarity of the configuration of the Kubernetes and Kafka hosts should help with fleet management and spare parts management. For our next redesign, we will try to further converge the designs on which we run the major Core workloads to further improve efficiency.</p><p>Special thanks to Will Buckner and Chris Snook for their help in the development of these servers, and to Tim Bart for validating CSAM Scanning Tool’s performance on Compute.</p> ]]></content:encoded>
            <category><![CDATA[Hardware]]></category>
            <category><![CDATA[Kafka]]></category>
            <category><![CDATA[Kubernetes]]></category>
            <category><![CDATA[ClickHouse]]></category>
            <category><![CDATA[Gen X]]></category>
            <guid isPermaLink="false">4fzfrcZ8XekQ1ykkMxltp1</guid>
            <dc:creator>Brian Bassett</dc:creator>
        </item>
        <item>
            <title><![CDATA[Securing Memory at EPYC Scale]]></title>
            <link>https://blog.cloudflare.com/securing-memory-at-epyc-scale/</link>
            <pubDate>Fri, 28 Feb 2020 14:00:00 GMT</pubDate>
            <description><![CDATA[ At Cloudflare, we encrypt data both in transit (on the network) and at rest (on the disk). Both practices address some of the most common vectors used to exfiltrate information and these measures serve to protect sensitive data from attackers but, what about data currently in use? ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Security is a serious business, one that we do not take lightly at Cloudflare. We have <a href="https://www.cloudflare.com/compliance/">invested a lot of effort</a> into ensuring that our services, both external and internal, are protected by meeting or exceeding industry best practices. Encryption is a huge part of our strategy as it is embedded in nearly every process we have. At Cloudflare, we encrypt data both in <a href="/rfc-8446-aka-tls-1-3/">transit</a> (on the network) and at rest (on the disk). Both practices address some of the most common vectors used to exfiltrate information and these measures serve to <a href="https://www.cloudflare.com/learning/security/what-is-information-security/">protect sensitive data</a> from attackers but, what about data currently in use?</p><p>Can encryption or any technology eliminate all threats? No, but as Infrastructure Security, it’s our job to consider worst-case scenarios. For example, what if someone were to steal a server from one of our <a href="https://www.cloudflare.com/network/">data centers</a>? How can we leverage the most reliable, cutting edge, innovative technology to secure all data on that host if it were in the wrong hands? Would it be protected? And, in particular, what about the server’s RAM?</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/F40SGb897EzCafJNfUMxo/9346da5cc95f377fd15c8ebe6d3a7077/mission-impossible-1.png" />
            
            </figure><p>Data in random access memory (RAM) is usually stored in the clear. This can leave data vulnerable to software or hardware probing by an attacker on the system. Extracting data from memory isn’t an easy task but, with the rise of <a href="https://www.snia.org/sites/default/files/SSSI/NVDIMM%20-%20Changes%20are%20Here%20So%20What's%20Next%20-%20final.pdf">persistent memory technologies</a>, additional attack vectors are possible:</p><ul><li><p>Dynamic random-access memory (<a href="https://user.eng.umd.edu/~blj/talks/DRAM-Tutorial-isca2002.pdf">DRAM</a>) interface snooping</p></li><li><p>Installation of hardware devices that access host memory</p></li><li><p><a href="https://en.wikipedia.org/wiki/Cold_boot_attack">Freezing and stealing</a> dual in-line memory module (<a href="https://en.wikipedia.org/wiki/DIMM">DIMMs</a>)</p></li><li><p>Stealing non-volatile dual in-line memory module (<a href="https://en.wikipedia.org/wiki/NVDIMM">NVDIMMs</a>)</p></li></ul><p>So, what about enclaves? Hardware manufacturers have introduced <a href="https://en.wikipedia.org/wiki/Trusted_execution_environment">Trusted Execution Environments</a> (also known as enclaves) to help create security boundaries by isolating software execution at runtime so that sensitive data can be processed in a trusted environment, such as secure area inside an existing processor or <a href="https://en.wikipedia.org/wiki/Trusted_Platform_Module">Trusted Platform Module</a>.</p><p>While this allows developers to shield applications in untrusted environments, it doesn’t effectively address all of the physical system attacks mentioned previously. Enclaves were also meant to run small pieces of code. You <i>could</i> run an <a href="https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-baumann.pdf">entire OS in an enclave</a>, but there are <a href="https://blog.quarkslab.com/overview-of-intel-sgx-part-1-sgx-internals.html">limitations</a> and performance issues in doing so.</p><p>This isn’t meant to bash enclave usage; we just wanted a better solution for encrypting all memory at scale. We expected performance to be compromised, and conducted tests to see just how much.</p>
    <div>
      <h2>Time to get EPYC</h2>
      <a href="#time-to-get-epyc">
        
      </a>
    </div>
    <p>Since we are using <a href="/cloudflares-gen-x-servers-for-an-accelerated-future/">AMD for our tenth generation "Gen X servers"</a>, we found an interesting security feature within the System on a Chip architecture of the AMD EPYC line. Secure Memory Encryption (SME) is an <a href="https://en.wikichip.org/wiki/x86">x86</a> instruction set <a href="https://en.wikichip.org/wiki/x86/extension">extension</a> introduced by AMD and available in the <a href="https://developer.amd.com/sev/">EPYC processor line.</a> SME provides the ability to mark individual pages of memory as encrypted using standard x86 page tables. A page that is marked encrypted will be automatically decrypted when read from DRAM and encrypted when written to DRAM. SME can therefore be used to protect the contents of DRAM from physical attacks on the system.</p><p>Sounds complicated, right? Here’s the secret: It isn’t ?</p>
    <div>
      <h2>Components</h2>
      <a href="#components">
        
      </a>
    </div>
    <p>SME is comprised of two components:</p><ul><li><p><b>AES-128 encryption</b> <b>engine</b>: Embedded in the memory controller. It is responsible for encrypting and decrypting data in main memory when an appropriate key is provided via the Secure Processor.</p></li><li><p><b>AMD Secure Processor (AMD-SP)</b>: An on-die 32-bit <a href="https://developer.arm.com/ip-products/processors/cortex-a/cortex-a5">ARM Cortex A5 CPU</a> that provides cryptographic functionality for secure key generation and key management. Think of this like a mini hardware security module that uses a hardware random number generator to generate the 128-bit key(s) used by the encryption engine.</p></li></ul>
    <div>
      <h2>How It Works</h2>
      <a href="#how-it-works">
        
      </a>
    </div>
    <p>We had two options available to us when it came to enabling SME. The first option, regular SME, requires enabling a model specific register <code>MSR 0xC001_0010[SMEE]</code>. This enables the ability to set a page table entry encryption bit:</p><ul><li><p>0 = memory encryption features are disabled</p></li><li><p>1 = memory encryption features are enabled</p></li></ul><p>After memory encryption is enabled, a physical address bit (C-Bit) is utilized to mark if a memory page is protected. The operating system sets the bit of a physical address to 1 in the page table entry (PTE) to indicate the page should be encrypted. This causes any data assigned to that memory space to be automatically encrypted and decrypted by the AES engine in the memory controller:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4Y55gr55Ypmf0kCFfSBrNN/d52fa52def521555431c16c76d9a1086/enclavng-diagrams_3x.png" />
            
            </figure>
    <div>
      <h3>Becoming More Transparent</h3>
      <a href="#becoming-more-transparent">
        
      </a>
    </div>
    <p>While arbitrarily flagging which page table entries we want encrypted is nice, our objective is to ensure that we are incorporating the full physical protection of SME. This is where the second mode of SME came in, Transparent SME (TSME). In TSME, all memory is encrypted regardless of the value of the encrypt bit on any particular page. This includes both instruction and data pages, as well as the pages corresponding to the page tables themselves.</p><p>Enabling TSME is as simple as:</p><ol><li><p>Setting a BIOS flag:</p></li></ol>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6AqdL0sTjEI4YKjHdwas11/d1f28bfac2bd91a7751fe4fe2aa25109/bios-tsme2.png" />
            
            </figure><p>2. Enabling kernel support with the following flag:</p><p><code>CONFIG_AMD_MEM_ENCRYPT=y</code></p><p>After a reboot you should see the following in <code>dmesg</code>:</p>
            <pre><code>$ sudo dmesg | grep SME
[    2.537160] AMD Secure Memory Encryption (SME) active</code></pre>
            
    <div>
      <h2>Performance Testing</h2>
      <a href="#performance-testing">
        
      </a>
    </div>
    <p>To weigh the pros and cons of implementation against the potential risk of a stolen server, we had to test the performance of enabling TSME. We took a test server that mirrored a production edge metal with the following specs:</p><ul><li><p>Memory: 8 x 32GB 2933MHz</p></li><li><p>CPU: AMD 2nd Gen EPYC 7642 with SMT enabled and running NPS4 mode</p></li><li><p>OS: Debian 9</p></li><li><p>Kernel: <a href="https://lwn.net/Articles/809568/">5.4.12</a></p></li></ul><p>The performance tools we used were:</p><ul><li><p><a href="http://www.cs.virginia.edu/stream/ref.html">STREAM</a></p></li><li><p><a href="http://man7.org/linux/man-pages/man8/cryptsetup.8.html">Cryptsetup</a></p></li><li><p>Benchmarky</p></li></ul>
    <div>
      <h2>Stream</h2>
      <a href="#stream">
        
      </a>
    </div>
    <p>We used a custom STREAM binary with 24 threads, using all available cores, to measure the sustainable memory bandwidth (in MB/s). Four synthetic computational kernels are run, with the output of each kernel being used as an input to the next. The best rates observed are reported for each choice of thread count.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1kwLMDcfqdWZ0dP9dgpbBO/a8ac5a90cd57a212539df64002fd1a04/Stream-SME-On-vs-Off-1.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3C8c6Nfn0cScGA0dt4yTaN/1bf1a1f32cceefac591aab63a1ab1e1c/Stream-Performance-delta-1.png" />
            
            </figure><p>The figures above show 2.6% to 4.2% performance variation, with a mean of 3.7%. These were the highest numbers measured, which fell below an expected performance impact of &gt;5%.</p>
    <div>
      <h2>Cryptsetup</h2>
      <a href="#cryptsetup">
        
      </a>
    </div>
    <p>While cryptsetup is normally used for encrypting disk partitions, it has a benchmarking utility that will report on a host’s cryptographic performance by iterating key derivation functions using memory only:</p><p>Example:</p>
            <pre><code>$ sudo cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1      1162501 iterations per second for 256-bit key
PBKDF2-sha256    1403716 iterations per second for 256-bit key
PBKDF2-sha512    1161213 iterations per second for 256-bit key
PBKDF2-ripemd160  856679 iterations per second for 256-bit key
PBKDF2-whirlpool  661979 iterations per second for 256-bit key</code></pre>
            
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5BC1HclFkbzijWahfsXLxH/67dec2664c6a31625c99613aef6b925e/cryptsetup-benchmark-SME-Off-vs-On-1.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1FoosofQ0iHlQbLAdi8fuS/950d23104a94ad5bd66f15614dd72b49/crypt-Performance-delta-1.png" />
            
            </figure>
    <div>
      <h2>Benchmarky</h2>
      <a href="#benchmarky">
        
      </a>
    </div>
    <p>Benchmarky is a homegrown tool <a href="/author/ivan/">provided by our Performance team</a> to run synthetic workloads against a specific target to evaluate performance of different components. It uses <a href="https://workers.cloudflare.com/">Cloudflare Workers</a> to send requests and read stats on responses. In addition to that, it also reports versions of all important stack components and their CPU usage. Each test runs 256 concurrent clients, grabbing a cached 10kB PNG image from a performance testing endpoint, and calculating the requests per second (RPS).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2uHw5bMNlZiKFLb3Ks5weQ/37cbcd116f472c6b20a35ede49d26f15/benckmarky-SME-off-and-SME-on-1.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3h5FsuK2Lv5xS3qUwv382A/2161213c7b0fb3715d9ab3eae66d4cc3/bench-Performance-delta-1.png" />
            
            </figure>
    <div>
      <h2>Conclusion</h2>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>In the majority of test results, performance decreased by a nominal amount, actually less than we expected. AMD’s official <a href="https://developer.amd.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf">white paper</a> on SME even states that encryption and decryption of memory through the AES engine does incur a small amount of additional latency for DRAM memory accesses, though dependent on the workload. Across all 11 data points, our average performance drag was only down by .699%. Even at scale, enabling this feature has reduced the worry that <i>any</i> data could be exfiltrated from a stolen server.</p><p>While we wait for other hardware manufacturers to add support for <a href="https://en.wikichip.org/wiki/x86/tme">total memory encryption,</a> we are happy that AMD has set the bar high and is protecting our next generation edge hardware.</p> ]]></content:encoded>
            <category><![CDATA[EPYC]]></category>
            <category><![CDATA[Hardware]]></category>
            <category><![CDATA[Data Center]]></category>
            <category><![CDATA[Cloudflare Network]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">8ZqsGZD6Kw9pakjpzsIuP</guid>
            <dc:creator>Derek Chamorro</dc:creator>
            <dc:creator>Brian Bassett</dc:creator>
        </item>
    </channel>
</rss>