<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>performance Archives | Clever Cloud</title>
	<atom:link href="https://www.clever.cloud/blog/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.clever.cloud/blog/tag/performance/</link>
	<description>From Code to Product</description>
	<lastBuildDate>Thu, 27 Nov 2025 14:46:26 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://cdn.clever-cloud.com/uploads/2023/03/cropped-cropped-favicon-32x32.png</url>
	<title>performance Archives | Clever Cloud</title>
	<link>https://www.clever.cloud/blog/tag/performance/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>In Defense of Optimization Work</title>
		<link>https://www.clever.cloud/blog/engineering/2018/09/27/in-defense-of-optimization-work/</link>
		
		<dc:creator><![CDATA[Geoffroy Couprie]]></dc:creator>
		<pubDate>Thu, 27 Sep 2018 17:15:00 +0000</pubDate>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[performance]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2018/09/27/in-defense-of-optimization-work/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="in defense of optimization 1" decoding="async" fetchpriority="high" srcset="https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1-1368x528.jpg 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p><p>It is common knowledge that <a href="https://blog.codinghorror.com/hardware-is-cheap-programmers-are-expensive/">hardware is cheap, and programmers are expensive</a>, and that most performance issues can be easily solved by throwing more and bigger hardware at it. But is it really cheaper in the long run? Is there still some room for optimization work?</p>
<span id="more-2814"></span>

<blockquote>
<p>&quot;The real problem is that programmers have spent far too much time worrying about efficiency in the wrong places and at the wrong times; premature optimization is the root of all evil (or at least most of it) in programming.&quot;</p>
</blockquote>
<div class="quote-credits">
Donald Knuth, [or Tony Hoare according to Donald Knuth, or Edsger W. Dijkstra according to Tony Hoare](https://shreevatsa.wordpress.com/2008/05/16/premature-optimization-is-the-root-of-all-evil/)
</div>

<p>Yes, we engineers like to optimize, spend time shaving off bytes and microseconds from our systems. And it is often at odds with the requirement to build features and squash bugs instead. Before we get into the cost comparison of optimization work VS hardware, allow me to reframe the issue: performance is not a goal isolated from other engineering business issues. Like security, it is a transversal problem:</p>
<ul>
<li>performance is a reliability issue, because it will trigger bigger and more frequent production issues</li>
<li>performance is a user experience issue, it affects directly how your users will work with your systems</li>
<li>performance is a cost issue</li>
</ul>
<p>And like security, it is not something we can ignore on a whim, it is part of the job.</p>
<p>Moreover, while we hear about hero stories of optimizations involving kernel ork or writing assembly manually, most performance work is actually quite simple, and boils down to tasks like:</p>
<ul>
<li>adding a cache</li>
<li>adding database indexes</li>
<li>doing some work inside a database query instead of loading all the data and analyzing manually</li>
</ul>
<p>It is actually rare (in web services) to have some optimization work that requires someone to write assembly manually or other fun tasks like this.</p>
<h2 id="the-cost-of-not-optimizing-code">The cost of not optimizing code</h2>
<p>If we take $100,000 as average programmer salary (in the US), it comes down to around $400 per day, so $50 per hour (20-21 days per month, 8 hours per day). So spending an afternoon optimizing code would amount to $200.</p>
<p>Using bigger or more hardware looks like a small cost comparatively. Let’s assume adding another machine would cost $20 to $50 per month. Let’s choose $20/month. The naive calculation would show that we recoup the costs of optimization work after 10 months. So at this point, thinking 10 months in advance might not be too interesting, and the cost of the machine is not too high. But after those 10 months, it starts costing more than having an engineer look at it.</p>
<p>Because here is the first difference: an optimization task is a fixed cost, done once, while the hardware cost is compounded (if the hardware is bought instead of rented, it will be amortized until the date of replacement). We easily trick ourselves into comparing the local, monthly cost, without looking at it on the long term.</p>
<p>But there is another aspect of the problem: performance issues are linked to business growth. Often not directly, but through some usage metric, like a number of messages sent, or a number of searches per second. Those grow with the number of customers. But they also grow with customer usage: if everything goes well, customers will use the product more and more. Do not expect performance issues to follow business growth linearly.</p>
<p>Let&#39;s take as example one of the metrics to evaluate a startup&#39;s growth: <a href="http://www.paulgraham.com/growth.html">the growth rate should be around 5-7% per week</a></p>
<p>Let&#39;s use the number of users as growth metric, and ignore usage growth.</p>
<p>Assuming that one node of the application is at full capacity with the current number of customers N, we add another node.</p>
<p>At 5% per week, we’re around 21% growth per month (21.550625% exactly, and that&#39;s calculated as a geometric progression). We will double the number of customers in just 15 weeks!</p>
<p>We can see the costs in the following graph. Red points represent the monthly cost, while blue points indicate how much we spent so far.</p>
<figure>
  <a href="https://www2.cleverapps.io/app/uploads/2021/08/growth-graph.png" rel="noopener noreferrer" target="_blank">
    <img style="width:100%" src="https://www2.cleverapps.io/app/uploads/2021/08/growth-graph.png">
  </a>
  <figcaption>Red points: monthly cost — Blue points: what we've spent so far</figcaption>
</figure>

<p>So we would spend: 1 more machine for the first 4 months, then we need to add one more. We will reach 3N at week 24 (6 months). We already spent $200 more than one machine. So this engineering time would pay for itself in 6 months, not 10. At week 40, we have already spent $560. Next week we will add another machine, because we will reach 7N.</p>
<p>After a year, we reached 12N, and paid $1140. We likely got other performance issues linked to the number of machines running, on-call issues, time spent updating them, etc. (But for all of those issues, we have Clever Cloud!) So we probably have more than 12 machines doing the work, and we spent considerable engineering time making them work.</p>
<p>Here&#39;s the equation: for a growth rate G, a number of months M, and a monthly cost C for one machine:</p>
<figure>
  <img style=" width: 180px;margin:0 auto;display: block;" src="https://www2.cleverapps.io/app/uploads/2021/08/growth-equation.png">
</figure>

<p>You can also test it in Wolfram Alpha <a href="http://www.wolframalpha.com/input/?i=sum+20+*+floor(1.05%5E(4m))+from+m+%3D+0+to+12N">(here for $20/month and growth at 5%)</a></p>
<p>To sum up, choosing the current settings as:</p>
<ul>
<li>$200 of work (4h at $50/h)</li>
<li>$20/month for a machine</li>
<li>5% growth per week</li>
</ul>
<p>We would spend $200 in new machines over the next 6 months, which is pretty short term. But there’s another way to look at it. We still need to fix the performance issue, but adding more hardware would buy us time. For the next 4 months, we would pay only $20 per month to delay the issue, and let our engineers work properly on it instead of putting out fires. Even better, now we have the means to plan hardware costs following business growth.</p>
<blockquote>
<p>&quot;Hardware is cheap, programmers are expensive;&quot;</p>
</blockquote>
<p style="margin-top: -60px; margin-bottom: 70px; text-align: center; font-style: italic; text-align: center;">…but performance debt comes with interests <span style="font-style:normal">(/¯–‿･)/¯</span></p>

<figure>
  <img style=" width: 450px;margin:0 auto;display: block;max-width:100%" src="https://www2.cleverapps.io/app/uploads/2021/08/goodbook.jpeg">
  <figcaption>The author, posing with what seems to be a good book.</figcaption>
</figure>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="in defense of optimization 1" decoding="async" srcset="https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/08/in-defense-of-optimization-1-1368x528.jpg 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p><p>It is common knowledge that <a href="https://blog.codinghorror.com/hardware-is-cheap-programmers-are-expensive/">hardware is cheap, and programmers are expensive</a>, and that most performance issues can be easily solved by throwing more and bigger hardware at it. But is it really cheaper in the long run? Is there still some room for optimization work?</p>
<span id="more-2814"></span>

<blockquote>
<p>&quot;The real problem is that programmers have spent far too much time worrying about efficiency in the wrong places and at the wrong times; premature optimization is the root of all evil (or at least most of it) in programming.&quot;</p>
</blockquote>
<div class="quote-credits">
Donald Knuth, [or Tony Hoare according to Donald Knuth, or Edsger W. Dijkstra according to Tony Hoare](https://shreevatsa.wordpress.com/2008/05/16/premature-optimization-is-the-root-of-all-evil/)
</div>

<p>Yes, we engineers like to optimize, spend time shaving off bytes and microseconds from our systems. And it is often at odds with the requirement to build features and squash bugs instead. Before we get into the cost comparison of optimization work VS hardware, allow me to reframe the issue: performance is not a goal isolated from other engineering business issues. Like security, it is a transversal problem:</p>
<ul>
<li>performance is a reliability issue, because it will trigger bigger and more frequent production issues</li>
<li>performance is a user experience issue, it affects directly how your users will work with your systems</li>
<li>performance is a cost issue</li>
</ul>
<p>And like security, it is not something we can ignore on a whim, it is part of the job.</p>
<p>Moreover, while we hear about hero stories of optimizations involving kernel ork or writing assembly manually, most performance work is actually quite simple, and boils down to tasks like:</p>
<ul>
<li>adding a cache</li>
<li>adding database indexes</li>
<li>doing some work inside a database query instead of loading all the data and analyzing manually</li>
</ul>
<p>It is actually rare (in web services) to have some optimization work that requires someone to write assembly manually or other fun tasks like this.</p>
<h2 id="the-cost-of-not-optimizing-code">The cost of not optimizing code</h2>
<p>If we take $100,000 as average programmer salary (in the US), it comes down to around $400 per day, so $50 per hour (20-21 days per month, 8 hours per day). So spending an afternoon optimizing code would amount to $200.</p>
<p>Using bigger or more hardware looks like a small cost comparatively. Let’s assume adding another machine would cost $20 to $50 per month. Let’s choose $20/month. The naive calculation would show that we recoup the costs of optimization work after 10 months. So at this point, thinking 10 months in advance might not be too interesting, and the cost of the machine is not too high. But after those 10 months, it starts costing more than having an engineer look at it.</p>
<p>Because here is the first difference: an optimization task is a fixed cost, done once, while the hardware cost is compounded (if the hardware is bought instead of rented, it will be amortized until the date of replacement). We easily trick ourselves into comparing the local, monthly cost, without looking at it on the long term.</p>
<p>But there is another aspect of the problem: performance issues are linked to business growth. Often not directly, but through some usage metric, like a number of messages sent, or a number of searches per second. Those grow with the number of customers. But they also grow with customer usage: if everything goes well, customers will use the product more and more. Do not expect performance issues to follow business growth linearly.</p>
<p>Let&#39;s take as example one of the metrics to evaluate a startup&#39;s growth: <a href="http://www.paulgraham.com/growth.html">the growth rate should be around 5-7% per week</a></p>
<p>Let&#39;s use the number of users as growth metric, and ignore usage growth.</p>
<p>Assuming that one node of the application is at full capacity with the current number of customers N, we add another node.</p>
<p>At 5% per week, we’re around 21% growth per month (21.550625% exactly, and that&#39;s calculated as a geometric progression). We will double the number of customers in just 15 weeks!</p>
<p>We can see the costs in the following graph. Red points represent the monthly cost, while blue points indicate how much we spent so far.</p>
<figure>
  <a href="https://www2.cleverapps.io/app/uploads/2021/08/growth-graph.png" rel="noopener noreferrer" target="_blank">
    <img style="width:100%" src="https://www2.cleverapps.io/app/uploads/2021/08/growth-graph.png">
  </a>
  <figcaption>Red points: monthly cost — Blue points: what we've spent so far</figcaption>
</figure>

<p>So we would spend: 1 more machine for the first 4 months, then we need to add one more. We will reach 3N at week 24 (6 months). We already spent $200 more than one machine. So this engineering time would pay for itself in 6 months, not 10. At week 40, we have already spent $560. Next week we will add another machine, because we will reach 7N.</p>
<p>After a year, we reached 12N, and paid $1140. We likely got other performance issues linked to the number of machines running, on-call issues, time spent updating them, etc. (But for all of those issues, we have Clever Cloud!) So we probably have more than 12 machines doing the work, and we spent considerable engineering time making them work.</p>
<p>Here&#39;s the equation: for a growth rate G, a number of months M, and a monthly cost C for one machine:</p>
<figure>
  <img style=" width: 180px;margin:0 auto;display: block;" src="https://www2.cleverapps.io/app/uploads/2021/08/growth-equation.png">
</figure>

<p>You can also test it in Wolfram Alpha <a href="http://www.wolframalpha.com/input/?i=sum+20+*+floor(1.05%5E(4m))+from+m+%3D+0+to+12N">(here for $20/month and growth at 5%)</a></p>
<p>To sum up, choosing the current settings as:</p>
<ul>
<li>$200 of work (4h at $50/h)</li>
<li>$20/month for a machine</li>
<li>5% growth per week</li>
</ul>
<p>We would spend $200 in new machines over the next 6 months, which is pretty short term. But there’s another way to look at it. We still need to fix the performance issue, but adding more hardware would buy us time. For the next 4 months, we would pay only $20 per month to delay the issue, and let our engineers work properly on it instead of putting out fires. Even better, now we have the means to plan hardware costs following business growth.</p>
<blockquote>
<p>&quot;Hardware is cheap, programmers are expensive;&quot;</p>
</blockquote>
<p style="margin-top: -60px; margin-bottom: 70px; text-align: center; font-style: italic; text-align: center;">…but performance debt comes with interests <span style="font-style:normal">(/¯–‿･)/¯</span></p>

<figure>
  <img style=" width: 450px;margin:0 auto;display: block;max-width:100%" src="https://www2.cleverapps.io/app/uploads/2021/08/goodbook.jpeg">
  <figcaption>The author, posing with what seems to be a good book.</figcaption>
</figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Falling for Rust</title>
		<link>https://www.clever.cloud/blog/engineering/2016/11/02/falling-for-rust/</link>
		
		<dc:creator><![CDATA[Geoffroy Couprie]]></dc:creator>
		<pubDate>Wed, 02 Nov 2016 16:02:00 +0000</pubDate>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Rust]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2016/11/02/falling-for-rust/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="falling rust 1" decoding="async" srcset="https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1-1368x528.png 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p>If you ever talked to me, or looked at my Twitter feed, you may have noticed that I campaign loudly for the <a href="https://www.clever.cloud/product/rust-applications/">Rust programming</a> language. I am not going to stop. In fact, it will only go crescendo!

<span id="more-2809"></span>

I got involved with that language <a href="https://github.com/Geal/rust-csv/commit/adaf9f09a3b3aa4889dc0213c88a83ae02219115">a while ago</a>, when I was looking for a safe alternative to C, for my research for the <a href="http://videolan.org/">Videolan</a> project. It was an interesting time, since the language changed often. I basically had to rewrite most of my code every two weeks. But since the release of Rust 1.0 in May 2015, it has gone from being an experimental tool to a serious contender for other system programming platforms.

I'm no longer the only one talking about Rust in the office, and the funny thing is that I'm not the first one to put some Rust in production! <a href="https://github.com/Keruspe">Marc-Antoine</a> started rewriting some management tools from bash to Rust, and they were working so well that they quickly ended up running on the platform.
<h2 id="why-we-are-betting-on-rust-for-the-future">Why we are betting on Rust for the future</h2>
We have always used heterogeneous technologies to manage the platform, mainly because we must know how they behave to host them properly. We test and use everything, and running them on our platform gives use the long term view.

For us, Rust gave substantial benefits from the beginning, and showed it is adapted to the way we run production code.
<h2 id="static-binaries">Static binaries</h2>
Like C, C++ and Go, Rust can build single file binaries that you will upload on a server and run directly, without any installed dependencies except a libc. This is significant, because when you want to reduce the base disk size and the boot time of a virtual machine, installing a lot of dependencies, like a Python virtual machine and its standard library, quickly takes its toll.

We built an immutable infrastructure: we do not modify virtual machines directly, instead we modify the base image and start new machines from scratch. So we're not too concerned about updating a dynamic library separately from the executable loading it.
<h2 id="reliability">Reliability</h2>
Memory safety is one of the biggest arguments of Rust, but it goes further than that. There's a big emphasis on providing safe patterns everywhere. As an example, data is immutable by default, you need to explicitely add "mut" to a variable to be able to change it. Most APIs will return an "Option" or "Result" type to safely wrap an actual result or an error, and there are lots of ways to manipulate them easily. Ignoring an error means explicitely adding an "unwrap()" call to that function's result.

All this means that by default, you write Rust code that should not crash, and that should not modify data unless explicitely stated. Add in a good type system to represent correctly and check assumptions. And some unit tests, because we know type systems don't replace them (although you don't need to write as many unit tests as in languages with simpler type systems).

You then get code that will rarely fail, and in which you can easily find the parts that break assumptions (example: grep for unsafe and unwrap). There will still be bugs, but you will work more on functional parts than on plumbing.
<h2 id="stability">Stability</h2>
Rust has no garbage collection. Most of the time, you won't care about this, because the benefit of using a language with a garbage collector outweights any of the usual concerns, like performance. Not caring about memory allocation lets you write code without fear of most memory vulnerabilities, and avoid most instances of memory leaks (sadly, not all of them). The real issue in production: the garbage collector disturbs the program's behaviour by regularly executing a task that goes through the memory to detect what to deallocate. Of course, it's not always as simple as a mark and sweep, but GC will still take some CPU time and introduce latency in other tasks. In situations of intense memory pressures (like, a lot of requests to handle), keeping lots of unusable memory around or stopping other tasks can trigger catastrophic failures. When the issue appears, people will typically spend a lot of time tweaking GC settings or rewriting code to avoid it. Either way, it's a lot of work.

Rust avoids garbage collection by handling memory allocation precisely at compile time. You get the same benefits without the runtime cost. The result? an application with predictable CPU and RAM usage. Typically, the RAM usage graphs will be flat, compared to the sawtooth graphs with garbage collectors. Predictability is a key feature for stable production systems: you can make more assumptions about the runtime behaviour and plan for resource usage.

On that point, you get another benefit: it is easy to make boundaries on resource usage. If I know roughly how much memory I need for X concurrent requests, and if I know the capacity of my server, I can put a soft limit on the number of concurrent requests, at which I set up an alert, and a hard limit, because I know that past that limit, the server will just stop answering properly.
<h2 id="not-worrying-about-it">Not worrying about it</h2>
For us, these benefits make a strong case for Rust as a reliable building block for a production platform. This is the piece of code we don't have to worry about, and it will enable others to run safely.
<h2 id="you-can-do-it-too">You can do it, too!</h2>
Right now, we are replacing small parts of the infrastructure, and we will soon unveil more interesting tools. In the meantime, we added <a href="https://www.clever.cloud/developers/doc/applications/rust/">Rust support in beta on our platform</a>: now you can deploy Rust web applications in a few commands.

Go ahead and put Rust in production!]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="falling rust 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/falling-rust-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p>If you ever talked to me, or looked at my Twitter feed, you may have noticed that I campaign loudly for the <a href="https://www.clever.cloud/product/rust-applications/">Rust programming</a> language. I am not going to stop. In fact, it will only go crescendo!

<span id="more-2809"></span>

I got involved with that language <a href="https://github.com/Geal/rust-csv/commit/adaf9f09a3b3aa4889dc0213c88a83ae02219115">a while ago</a>, when I was looking for a safe alternative to C, for my research for the <a href="http://videolan.org/">Videolan</a> project. It was an interesting time, since the language changed often. I basically had to rewrite most of my code every two weeks. But since the release of Rust 1.0 in May 2015, it has gone from being an experimental tool to a serious contender for other system programming platforms.

I'm no longer the only one talking about Rust in the office, and the funny thing is that I'm not the first one to put some Rust in production! <a href="https://github.com/Keruspe">Marc-Antoine</a> started rewriting some management tools from bash to Rust, and they were working so well that they quickly ended up running on the platform.
<h2 id="why-we-are-betting-on-rust-for-the-future">Why we are betting on Rust for the future</h2>
We have always used heterogeneous technologies to manage the platform, mainly because we must know how they behave to host them properly. We test and use everything, and running them on our platform gives use the long term view.

For us, Rust gave substantial benefits from the beginning, and showed it is adapted to the way we run production code.
<h2 id="static-binaries">Static binaries</h2>
Like C, C++ and Go, Rust can build single file binaries that you will upload on a server and run directly, without any installed dependencies except a libc. This is significant, because when you want to reduce the base disk size and the boot time of a virtual machine, installing a lot of dependencies, like a Python virtual machine and its standard library, quickly takes its toll.

We built an immutable infrastructure: we do not modify virtual machines directly, instead we modify the base image and start new machines from scratch. So we're not too concerned about updating a dynamic library separately from the executable loading it.
<h2 id="reliability">Reliability</h2>
Memory safety is one of the biggest arguments of Rust, but it goes further than that. There's a big emphasis on providing safe patterns everywhere. As an example, data is immutable by default, you need to explicitely add "mut" to a variable to be able to change it. Most APIs will return an "Option" or "Result" type to safely wrap an actual result or an error, and there are lots of ways to manipulate them easily. Ignoring an error means explicitely adding an "unwrap()" call to that function's result.

All this means that by default, you write Rust code that should not crash, and that should not modify data unless explicitely stated. Add in a good type system to represent correctly and check assumptions. And some unit tests, because we know type systems don't replace them (although you don't need to write as many unit tests as in languages with simpler type systems).

You then get code that will rarely fail, and in which you can easily find the parts that break assumptions (example: grep for unsafe and unwrap). There will still be bugs, but you will work more on functional parts than on plumbing.
<h2 id="stability">Stability</h2>
Rust has no garbage collection. Most of the time, you won't care about this, because the benefit of using a language with a garbage collector outweights any of the usual concerns, like performance. Not caring about memory allocation lets you write code without fear of most memory vulnerabilities, and avoid most instances of memory leaks (sadly, not all of them). The real issue in production: the garbage collector disturbs the program's behaviour by regularly executing a task that goes through the memory to detect what to deallocate. Of course, it's not always as simple as a mark and sweep, but GC will still take some CPU time and introduce latency in other tasks. In situations of intense memory pressures (like, a lot of requests to handle), keeping lots of unusable memory around or stopping other tasks can trigger catastrophic failures. When the issue appears, people will typically spend a lot of time tweaking GC settings or rewriting code to avoid it. Either way, it's a lot of work.

Rust avoids garbage collection by handling memory allocation precisely at compile time. You get the same benefits without the runtime cost. The result? an application with predictable CPU and RAM usage. Typically, the RAM usage graphs will be flat, compared to the sawtooth graphs with garbage collectors. Predictability is a key feature for stable production systems: you can make more assumptions about the runtime behaviour and plan for resource usage.

On that point, you get another benefit: it is easy to make boundaries on resource usage. If I know roughly how much memory I need for X concurrent requests, and if I know the capacity of my server, I can put a soft limit on the number of concurrent requests, at which I set up an alert, and a hard limit, because I know that past that limit, the server will just stop answering properly.
<h2 id="not-worrying-about-it">Not worrying about it</h2>
For us, these benefits make a strong case for Rust as a reliable building block for a production platform. This is the piece of code we don't have to worry about, and it will enable others to run safely.
<h2 id="you-can-do-it-too">You can do it, too!</h2>
Right now, we are replacing small parts of the infrastructure, and we will soon unveil more interesting tools. In the meantime, we added <a href="https://www.clever.cloud/developers/doc/applications/rust/">Rust support in beta on our platform</a>: now you can deploy Rust web applications in a few commands.

Go ahead and put Rust in production!]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
