<?xml version="1.0" encoding="UTF-8"?><rss 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" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eric Mercier on Medium]]></title>
        <description><![CDATA[Stories by Eric Mercier on Medium]]></description>
        <link>https://medium.com/@EricWebo?source=rss-7d4761545b94------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8qECZjNXKbbYqgzk</url>
            <title>Stories by Eric Mercier on Medium</title>
            <link>https://medium.com/@EricWebo?source=rss-7d4761545b94------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 09:44:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@EricWebo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Exploring technologies at Weborama: The Rust language]]></title>
            <link>https://medium.com/weborama/introduction-to-the-rust-programming-language-4dbf8f3016de?source=rss-7d4761545b94------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dbf8f3016de</guid>
            <category><![CDATA[benchmark]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[rust]]></category>
            <dc:creator><![CDATA[Eric Mercier]]></dc:creator>
            <pubDate>Tue, 27 Sep 2022 10:21:35 GMT</pubDate>
            <atom:updated>2022-11-03T17:23:02.301Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*shd_u_ZpOnucYa0Z" /><figcaption>Photo by <a href="https://unsplash.com/ja/@chanphoto?utm_source=medium&amp;utm_medium=referral">Chandler Cruttenden</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>At Weborama, we use (or used to use) a lot of programming languages: Perl, Ruby, PHP, JavaScript, Typescript, Clojure, Python, Groovy…</p><p>Today, we mainly use <a href="https://www.java.com/">Java</a> (with the <a href="https://spring.io/">Spring</a> stack) and <a href="https://go.dev/">Go</a>, for our back-end services (we also are a big <a href="https://vuejs.org/">Vue.JS</a> shop, but this is another story).</p><p>While we are perfectly happy with Java and Go, with their ecosystem and with the way they fit our needs, we try to keep our eyes open and are frequently looking at new technologies that could help us improve performances or reduce resource consumption.</p><p>This mindset is well-shared within our engineering teams. For example, we progressively migrated our stacks to micro-service architectures powered by <a href="https://www.docker.co/">Docker</a> and <a href="https://kubernetes.io/">Kubernetes</a>, as many of other companies in the industry did. We also experiment with new database systems regularly or even try new cloud services provided either by <a href="https://cloud.google.com/">Google Cloud Platform</a> or <a href="https://aws.amazon.com/">Amazon Web Services</a> (we like to be hybrid!).</p><p>Of course, we want to remain pragmatic, and we won’t revolutionize our coding guidelines every semester. But on the other hand, testing new approaches (or in this case, new languages), is an interesting exercise to do, helps staying up-to-date with state-of-the-art practices and gives perspective on our current way of working.</p><p>So, long story short, <strong>Rust entered our radar</strong>.</p><h3>The Rust language in a nutshell</h3><p>If I had to summarize it with one sentence, I’d say <em>Rust offers good performances while being resource-efficient.</em></p><p>More specifically, its <a href="https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html">ownership memory management system</a> makes it memory safe and avoids race conditions. Its community is solid and helpful, and even if the ecosystem is still young, it’s growing at fast pace, <a href="https://github.com/UgurcanAkkok/AreWeRustYet">in all domains</a>. There is a lot of well written documentation to help new <a href="https://rustaceans.org/"><em>rustaceans</em></a> in their journey, and the existing tools (<em>cargo</em>, <em>clippy</em>, or <em>rust-analyzer</em> to name a few) are super useful.</p><p>All of this made Rust the most beloved language for 6 years in a row, according to <a href="https://insights.stackoverflow.com/survey/2021#technology-most-loved-dreaded-and-wanted">Stack Overflow 2021 insights</a>.</p><p>So, we wanted to give it a try.</p><h3>Testing Rust at Weborama</h3><p>We came up with a small benchmark that we tried to make as close as possible to a real use-case: a micro service that exposes a <a href="https://en.wikipedia.org/wiki/Representational_state_transfer">ReST</a> endpoint, does some computation and a database call, sends a message to a broker and returns the message in the HTTP response.</p><p>Of course, our real-life programs do more complex stuff in reality, but this small example should give us some insights on how Rust would behave in a close-enough technical environment.</p><p>For this benchmark, I asked some of my friendly colleagues to play this little game with me by implementing the test service in their favorite language, without searching for over-optimization. We ended up with a total of 7 challengers:</p><ul><li><a href="https://github.com/Weborama/RustBenchmark/tree/main/rust">Rust (obviously)</a></li><li><a href="https://github.com/Weborama/RustBenchmark/tree/main/go">Go</a></li><li><a href="https://github.com/Weborama/RustBenchmark/tree/main/java-spring">Java Spring MVC</a></li><li><a href="https://github.com/Weborama/RustBenchmark/tree/main/java-spring-reactive">Java Spring Reactive</a></li><li><a href="https://github.com/Weborama/RustBenchmark/tree/main/python">Python</a></li><li><a href="https://github.com/Weborama/RustBenchmark/tree/main/clojure">Clojure</a></li><li><a href="https://github.com/Weborama/RustBenchmark/tree/main/groovy">Groovy</a></li></ul><p>All of them were built as a <a href="https://www.docker.com/">Docker</a> image and deployed on a <a href="https://kubernetes.io/">Kubernetes</a> cluster, along side with a <a href="https://www.postgresql.org/">PostgreSQL</a> database and a <a href="https://www.rabbitmq.com/">RabbitMQ</a> message broker. Of course, all the implementations were given the same amount of resources on the cluster.</p><p>We looked at 3 metrics: <em>time </em>to complete a request, <em>memory</em> consumption and <em>CPU</em> usage.</p><p>We used <a href="https://jmeter.apache.org/">Apache JMeter</a> to send <strong>50 concurrent requests</strong> during <strong>30 seconds</strong> for each implementations, after a warmup round. The Kubernetes cluster is located on the <em>eu-west-1</em> AWS zone, in Ireland and the client is located near Paris, in France.</p><p>So enough with the chitchat, let’s see the result! Here is the number of samples ran by each implementation in the given time:</p><ul><li>Clojure: 7658</li><li>Go: 6755</li><li>Groovy: 6890</li><li>Java Reactive: 7303</li><li>Java Spring MVC: 7147</li><li>Python: 6379</li><li>Rust: <strong>8019</strong></li></ul><p>We can see that <strong>Rust wins the challenge</strong> (it’s the only implementation able to run more than 8000 samples), but <strong>by a really small margin</strong> on average.</p><p>Looking at the <strong>response time percentiles</strong>, we can see that all implementations are roughly performing the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*fu7pZ5vq7Ax1ZinUvE1KQA.jpeg" /><figcaption>Response Time Percentiles (more or less the same for all implementations)</figcaption></figure><p>So what can we conclude there? Well, <strong>good performances are there</strong>, for <strong>every runtime environment</strong>, but the next question is: <em>at which price, resource-wise</em>?</p><h3>Resource Consumption Analysis</h3><p>To monitor the resource consumption on our cluster, we’ll rely on our fantastic <a href="https://grafana.com/oss/prometheus/">Prometheus/Grafana</a> stack. Here, I made a small comparison of <strong>memory</strong> and <strong>CPU</strong> consumption for each container.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/52563dfe5d5cf29571516ee64a3b9098/href">https://medium.com/media/52563dfe5d5cf29571516ee64a3b9098/href</a></iframe><p>We can obviously split the results in two families: <strong>JVM based</strong> and <strong>non-JVM based</strong> languages.</p><p>As much as I love the JVM, all its wonders come with a price: <strong>memory </strong>(not really a surprise, I agree). Indeed, Clojure, Groovy and Spring implementations are the most memory intensive. Since the JVM allows rapid and robust development, and given that today’s computers are filled with RAM, it’s a price we agree to pay <em>most of the time</em>.</p><p>Among non-JVM languages, Rust is a clear winner here. It uses at bit more than <strong>half of the memory of the Go implementation</strong>, and <strong>close to 10% of the Spring one</strong>…</p><p>A first conclusion could be: <em>if you want to save memory, Rust should clearly be considered.</em></p><p>Speaking about the CPU usage, none of the contenders uses 100% of the allocated CPU, meaning we probably hit a bottleneck somewhere. Is this the I/O with RabbitMQ or with PostgreSQL? To be fair, I didn’t take the time to dig into this issue. All we can see is that <strong>our Rust implementation uses less CPU than the others</strong>.</p><p><strong>So, we can see that with Rust, we can do <em>the same</em> (if not <em>more</em>) with <em>less</em>.</strong></p><p>This reminds me a <a href="https://www.cloudcity.io/blog/2018/11/08/parsing-logs-230x-faster-with-rust/">blog post</a> I read few years ago: it talks about a guy who needed to parse a lot of files and ended up with a Rust implementation that was so fast it allowed him to parse 500 GB of logs per day while staying in the free tier of <a href="https://aws.amazon.com/lambda/">AWS lambda</a>!</p><h3>What about Rust drawbacks?</h3><p>But of course, there’s no such thing as perfection, and everything in life comes at a price.</p><p>One of the drawback of the Rust adoption is its <strong>steep learning curve</strong>. Even if its memory management is easier than with C for example, it’s still something you have to learn and <em>master</em> during your development phases.</p><p>When you’re used to having garbage collection nearby (like with Java or Go), it’s quite tough to go back to <strong>thinking about memory</strong> in your code, particularly since the Rust compiler is really severe (and it’s a good thing, if you ask me!) when it comes to <a href="https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html">borrow checking</a>.</p><p>Also, you will probably hate `<strong>rustc</strong>` at first… (before falling in love with it, as it will prevent you from doing a lot of mistakes, trust me).</p><p>Another thing that could be frustrating is <strong>the compile time</strong>. It can be long, particularly the first time you build your project with all its dependencies. But this is something Rust engineers are aware of, they are <a href="https://github.com/rust-lang/rust/issues/48547">working on it</a> and let’s be honest: it’s not <em>that</em> bad and I’d rather “pay” more compile time to save some run time and memory footprint.</p><h3>So, what to conclude about Rust?</h3><p>I had a lot of fun working with Rust for this little study. I think this is a really interesting language with a lot of powerful capabilities, and I believe, in situations where memory space is limited, performances expected and bullet-proof robustness aimed for, it’s probably the best option out there.</p><p>Of course, in reality, many considerations come into play when you want to introduce a new language in a company, or even in a team. You have to think about team work, maintainability and of course, hiring.</p><p>What I know for now, is that if at some point we’re facing a performance or memory footprint issue at Weborama, we’ll know that Rust will be a solid option to consider.</p><p>It’s also interesting to see that Rust is becoming more and more popular in big Tech companies such as Facebook, Google or Amazon, and it’s another reason why we should keep it close to our eyes.</p><p>If you’re using Rust at your company, feel free to leave a comment below. It’s always interesting to see real-life examples and testimonials when looking at new languages.</p><p><em>A huge thank to my colleagues David, Fabrice, Gabriel, Nelson, Nicolas, Rachid and Valentin, who contributed to the code written for this article and helped me to set up the environment and Alexis for proofreading this article. You rock guys!</em></p><p><em>You can find all the sources </em><a href="https://github.com/Weborama/RustBenchmark"><em>here</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dbf8f3016de" width="1" height="1" alt=""><hr><p><a href="https://medium.com/weborama/introduction-to-the-rust-programming-language-4dbf8f3016de">Exploring technologies at Weborama: The Rust language</a> was originally published in <a href="https://medium.com/weborama">Weborama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>