[{"data":1,"prerenderedAt":1341},["ShallowReactive",2],{"header_en":3,"footer_en":217,"page-articles_en-\u002Fen\u002Finsights-events\u002Fposts\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust":276,"picked-page-cards-":1302,"breadcrumb-\u002Fen\u002Finsights-events\u002Fposts\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust":1303,"recommendations-en-\u002Fen\u002Finsights-events\u002Fposts\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust-data-marketing":1307},{"id":4,"contact":5,"extension":8,"locales":9,"meta":16,"navigationItems":17,"search":205,"stem":207,"topbar":208,"__hash__":216},"header_en\u002Fen\u002Fheader.yaml",{"label":6,"link":7},"Contact","\u002Fen\u002Fcompany\u002Fcontact\u002F","yaml",[10,13],{"code":11,"label":12},"en","English",{"code":14,"label":15},"fr","Français",{},[18,92,160,173,177,201],{"label":19,"link":20,"items":21},"Capabilities","\u002Fen\u002Fcapabilities\u002F",[22,41,60,79],{"name":23,"link":24,"links":25},"CRM","\u002Fen\u002Fcapabilities\u002Fcrm\u002F",[26,29,32,35,38],{"label":27,"link":28},"Consumer Insights & Analytics","\u002Fen\u002Fcapabilities\u002Fcrm\u002Fconsumer-insights-analytics\u002F",{"label":30,"link":31},"CRM Strategy","\u002Fen\u002Fcapabilities\u002Fcrm\u002Fcrm-strategy\u002F",{"label":33,"link":34},"Loyalty strategy & Modeling","\u002Fen\u002Fcapabilities\u002Fcrm\u002Floyalty-strategy-modeling\u002F",{"label":36,"link":37},"Omnichannel campaign management","\u002Fen\u002Fcapabilities\u002Fcrm\u002Fomnichannel-campaign-management\u002F",{"label":39,"link":40},"SMS, RCS, Whatsapp campaigns","\u002Fen\u002Fcapabilities\u002Fcrm\u002Fsms-rcs-whatsapp-campaigns\u002F",{"name":42,"link":43,"links":44},"Data & AI","\u002Fen\u002Fcapabilities\u002Fdata-ai\u002F",[45,48,51,54,57],{"label":46,"link":47},"Cleanroom & Data Collaboration","\u002Fen\u002Fcapabilities\u002Fdata-ai\u002Fclean-room-data-collaboration\u002F",{"label":49,"link":50},"Data Acquisition","\u002Fen\u002Fcapabilities\u002Fdata-ai\u002Fdata-acquisition\u002F",{"label":52,"link":53},"Data & AI Strategy","\u002Fen\u002Fcapabilities\u002Fdata-ai\u002Fdata-ai-strategy\u002F",{"label":55,"link":56},"Organizational & Digital Transformation","\u002Fen\u002Fcapabilities\u002Fdata-ai\u002Forganizational-digital-transformation\u002F",{"label":58,"link":59},"Upskilling programs","\u002Fen\u002Facademy\u002F",{"name":61,"link":62,"links":63},"Digital Media & AdTech","\u002Fen\u002Fcapabilities\u002Fdigital-media\u002F",[64,67,70,73,76],{"label":65,"link":66},"Display, Video & CTV","\u002Fen\u002Fcapabilities\u002Fdigital-media\u002Fdisplay-video-ctv\u002F",{"label":68,"link":69},"Measurement & Media Strategy","\u002Fen\u002Fcapabilities\u002Fdigital-media\u002Fmeasurement-media-strategy\u002F",{"label":71,"link":72},"Retail media","\u002Fen\u002Fcapabilities\u002Fdigital-media\u002Fretail-media\u002F",{"label":74,"link":75},"SEA & GEA, SEO & GEO","\u002Fen\u002Fcapabilities\u002Fdigital-media\u002Fsea-gea-seo-geo\u002F",{"label":77,"link":78},"Social","\u002Fen\u002Fcapabilities\u002Fdigital-media\u002Fsocial\u002F",{"name":80,"link":81,"links":82},"Numberly MarTech Platform","\u002Fen\u002Fplatform\u002F",[83,86,89],{"label":84,"link":85},"Customer Data Platform","\u002Fen\u002Fplatform\u002Fsolution\u002Fcustomer-data-platform\u002F",{"label":87,"link":88},"Marketing Automation Tool & APIs","\u002Fen\u002Fplatform\u002Fsolution\u002Fconnectivity-api\u002F",{"label":90,"link":91},"Performance AI","\u002Fen\u002Fplatform\u002Fperformance-ai\u002F",{"label":93,"link":81,"featured":94,"items":99},"Platform",{"title":80,"description":95,"links":96},"AI-powered customer engagement: from marketing to service experience.",[97],{"label":98,"link":81},"Our Solution at a glance",[100,112,125,147],{"name":101,"link":81,"links":102},"Solution",[103,104,107,109],{"label":84,"link":85},{"label":105,"link":106},"CRM Journey orchestration","\u002Fen\u002Fplatform\u002Fsolution\u002Fcrm-journey-orchestration\u002F",{"label":108,"link":88},"Connectivity & APIs",{"label":110,"link":111},"Cleanroom & No movement","\u002Fen\u002Fplatform\u002Fsolution\u002Fclean-room\u002F",{"name":90,"link":91,"links":113},[114,117,120,123],{"label":115,"link":116},"Predictive segmentation","\u002Fen\u002Fplatform\u002Fperformance-ai\u002Fpredictive-segmentation\u002F",{"label":118,"link":119},"Content Builder & Gen AI","\u002Fen\u002Fplatform\u002Fperformance-ai\u002Fcontent-builder-gen-ai\u002F",{"label":121,"link":122},"Performance measurement and AI recommendation","\u002Fen\u002Fplatform\u002Fperformance-ai\u002Fperformance-measurement\u002F",{"label":124,"link":91},"All AI features",{"name":126,"link":127,"links":128},"Channels","\u002Fen\u002Fplatform\u002Fchannels\u002Fall-channels\u002F",[129,132,135,138,141,144],{"label":130,"link":131},"Email","\u002Fen\u002Fplatform\u002Fchannels\u002Femail\u002F",{"label":133,"link":134},"SMS, RCS","\u002Fen\u002Fplatform\u002Fchannels\u002Fsms-rcs\u002F",{"label":136,"link":137},"Whatsapp","\u002Fen\u002Fplatform\u002Fchannels\u002Fwhatsapp\u002F",{"label":139,"link":140},"Push notifications","\u002Fen\u002Fplatform\u002Fchannels\u002Fpush-notifications\u002F",{"label":142,"link":143},"Social Media","\u002Fen\u002Fplatform\u002Fchannels\u002Fsocial-media\u002F",{"label":145,"link":146},"All channels","\u002Fen\u002Fplatform\u002Fchannels\u002Fall-channels",{"name":148,"link":149,"links":150},"Resources","\u002Fen\u002Fplatform\u002Fresources\u002F",[151,154,157],{"label":152,"link":153},"Support at your service","\u002Fen\u002Fplatform\u002Fresources\u002Fsupport-at-your-service\u002F",{"label":155,"link":156},"Impactly","\u002Fen\u002Fplatform\u002Fresources\u002Fimpactly\u002F",{"label":158,"link":159},"API Documentation & Guides","\u002Fen\u002Fplatform\u002Fresources\u002Fapi-documentation-guides\u002F",{"label":161,"link":59,"items":162},"Academy",[163],{"name":161,"links":164},[165,167,170],{"label":166,"link":59},"Numberly Academy",{"label":168,"link":169},"All our programs","\u002Fen\u002Facademy\u002Fall-programs\u002F",{"label":171,"link":172},"Tailor made programs","\u002Fen\u002Facademy\u002Ftailor-made-programs\u002F",{"label":174,"link":175,"items":176},"Insights & Events","\u002Fen\u002Finsights-events\u002F",[],{"label":178,"link":179,"items":180},"Company","\u002Fen\u002Fcompany\u002Fabout-us\u002F",[181],{"name":178,"links":182},[183,185,188,191,194,197,200],{"label":184,"link":179},"About us",{"label":186,"link":187},"Our story","\u002Fen\u002Fcompany\u002Four-story\u002F",{"label":189,"link":190},"Our references","\u002Fen\u002Fcompany\u002Four-references\u002F",{"label":192,"link":193},"Citizenship (CSR)","\u002Fen\u002Fcompany\u002Fcitizenship\u002F",{"label":195,"link":196},"Compliance & Labels","\u002Fen\u002Fcompany\u002Fcompliance-labels\u002F",{"label":198,"link":199},"Numberly Alumni","\u002Fen\u002Fcompany\u002Falumni\u002F",{"label":6,"link":7},{"label":202,"link":203,"items":204},"Join Us","https:\u002F\u002Fjoinus.numberly.com\u002Fen\u002F",[],{"label":206},"Search","en\u002Fheader",{"darkMode":209,"accessibility":211},{"label":210},"Dark Mode",{"label":212,"typographies":213,"dyslexiaFont":214,"lineSpacing":215},"Accessibility","Typographies","Dyslexia font","Increased line spacing","hYFBYGptD82n7u10cq7qvICQ4sc7TTYI4cVbA213qtg",{"id":218,"contact":219,"copyright":227,"extension":8,"legalLinks":228,"links":252,"meta":260,"socials":261,"stem":274,"__hash__":275},"footer_en\u002Fen\u002Ffooter.yaml",{"title":220,"description":221,"cta":222},"How can we help you today?","We look forward to connecting. Please share your questions or feedback below, and our experts will ensure you receive a timely response.",{"label":223,"color":224,"size":225,"variant":226,"link":7},"Contact us","primary","md","solid","© 2026 Numberly. All rights reserved",[229,232,235,238,240,243,246,249],{"label":230,"link":231},"Data Protection & Privacy","https:\u002F\u002Fwww.iubenda.com\u002Fprivacy-policy\u002F61246078",{"label":233,"link":234},"Cookie Policy","https:\u002F\u002Fwww.iubenda.com\u002Fprivacy-policy\u002F61246078\u002Fcookie-policy",{"label":236,"link":237},"Legal Notice","\u002Fen\u002Flegal-notices\u002F",{"label":212,"link":239},"\u002Fen\u002Faccessibility\u002F",{"label":241,"link":242},"Data Protection and Privacy Charter","https:\u002F\u002Fnumberly-2026.numberly.dev\u002Fen\u002Fdata-protection-privacy-charter",{"label":244,"link":245},"Information for our partners","\u002Fen\u002Finformation-for-our-partners\u002F",{"label":247,"link":248},"Glossary","\u002Fen\u002Fglossary\u002F",{"label":250,"link":251},"Site map","\u002Fen\u002Fsitemap\u002F",[253,254,255,256,257,258],{"label":19,"link":20},{"label":93,"link":81},{"label":161,"link":59},{"label":174,"link":175},{"label":178,"link":179},{"label":202,"link":259},"https:\u002F\u002Fjoinus.numberly.com",{},[262,266,270],{"name":263,"icon":264,"link":265},"LinkedIn","i-mdi-linkedin","https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fnumberly\u002F",{"name":267,"icon":268,"link":269},"YouTube","i-mdi-youtube","https:\u002F\u002Fwww.youtube.com\u002Fchannel\u002FUCvXTjafCEsCWFqmToe71Kzw",{"name":271,"icon":272,"link":273},"GitHub","i-mdi-github","http:\u002F\u002Fgithub.com\u002Fnumberly","en\u002Ffooter","EuGhRZ3rEVdr05Lu_PyLj_d91y_qVecdLsqpTovjdQU",{"id":277,"title":278,"author":279,"body":284,"category":1278,"contentType":1279,"description":301,"devOnly":1280,"exclude":1281,"extension":225,"label":1282,"legacy":1283,"locale":11,"meta":1287,"navigation":1288,"path":1289,"publishedAt":1290,"seo":1291,"sitemap":1292,"stem":1295,"tags":1296,"topics":1281,"translations":1298,"__hash__":1301},"articles_en\u002Fen\u002Finsights-events\u002Fposts\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust.md","Building a 100% ScyllaDB Shard-Aware Application Using Rust",{"name":280,"role":281,"avatar":282},"Alexys Jacob","CTO",{"src":283},"\u002FAlexys-Jacob-Monier.jpg",{"type":285,"value":286,"toc":1275},"minimark",[287,302,335,373,443,527,572,739,770,791,795,835,899,925,966,977,988,999,1044,1075,1266],[288,289,290,297],"article-hero",{},[291,292,294],"template",{"v-slot:title":293},"",[295,296,278],"p",{},[291,298,299],{"v-slot:description":293},[295,300,301],{},"Discover our innovative project rewarded by ScyllaDB's Technical Achievement Award",[303,304,309,314],"insight-section",{"variant":305,"width":306,":image":307,":fluidText":308},"neutral","wide","{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F063493c7bb-smndHc6m-ss23-awards-4-768x432-1.jpg\",\"alt\":\"Certificate of the ScyllaDB Technical Achievement Award with the Numberly logo\"}","true",[291,310,311],{"v-slot:title":293},[295,312,313],{},"This breakthrough design has been awarded",[291,315,316,330],{"v-slot:body":293},[295,317,318,319,329],{},"We are proud to have been given ",[320,321,322],"strong",{},[323,324,328],"a",{"href":325,"rel":326},"https:\u002F\u002Fwww.scylladb.com\u002F2023\u002F02\u002F21\u002Fscylladb-innovation-awards-honor-impressive-nosql-rust-low-latency-achievements\u002F",[327],"nofollow","ScyllaDB’s Technical Achievement Award for Outstanding Innovative Project","   involving ScyllaDB by designing a data processing application leveraging on an innovative low-level architectural design. This breakthrough design brings amazing strengths like idempotence, deterministic and distributed data processing along with infinite scalability that benefits our clients. We are really humbled for this recognition that rewards both our teams’ technical expertise and Open-Source community contributions.",[295,331,332],{},[320,333,334],{},"It is now in production at Numberly, learn more about it in this article!",[303,336,339,344],{"variant":305,"width":306,":image":337,"imagePosition":338},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F500d15179b-LMiWHKM3-scylladb-1.jpg\",\"alt\":\"Diagram showing gateways that converge towards a central message routing platform\"}","full",[291,340,341],{"v-slot:title":293},[295,342,343],{},"Project Context",[291,345,346,353,356,363,366],{"v-slot:body":293},[295,347,348,349,352],{},"At Numberly, the ",[320,350,351],{},"Omnichannel Delivery team"," has the ownership of all the types of messages we support and operate for our clients.",[295,354,355],{},"From the well known and established email to the still emerging RCS without forgetting the OTT platforms such as WhatsApp.",[295,357,358,359,362],{},"The team recently got the chance to build a “platform to rule them all” with the ",[320,360,361],{},"goal of streamlining how all our components send and track messages, whatever their form",".",[295,364,365],{},"The general logic is as follows: clients or programmatic platforms send messages or batch of messages using REST API gateways which are responsible for validating and rendering the message payload.",[295,367,368,369,372],{},"Then those gateways will all converge towards a ",[320,370,371],{},"Central Message Routing Platform"," which will implement full featured scheduling, accounting, tracing and of course routing of the messages using the right platform or operators connectors.",[303,374,375,380],{"variant":305,"width":306},[291,376,377],{"v-slot:title":293},[295,378,379],{},"Looking at the Central Messaging Platform",[291,381,382,389,392,402,409,416,422,428,435,438],{"v-slot:body":293},[383,384,386],"h3",{"id":385},"high-constraints",[320,387,388],{},"High constraints",[295,390,391],{},"Now putting all your eggs in one basket is always risky right?",[295,393,394,395,398,399],{},"Making this kind of move ",[320,396,397],{},"puts a lot of constraints to our platform requirements",". It has to be very ",[320,400,401],{},"reliable!",[295,403,404,405,408],{},"First as being ",[320,406,407],{},"highly available and resilient",", because it will become a single point of failure for all our messages.",[295,410,411,412,415],{},"Second as being able to ",[320,413,414],{},"scale fast"," to match the growth of one or multiple channels at once as our routing needs change.",[383,417,419],{"id":418},"strong-guarantees",[320,420,421],{},"Strong guarantees",[295,423,424,425,362],{},"High Availability and scale look easy when compared to our ",[320,426,427],{},"observability and idempotence requirements",[295,429,430,431,434],{},"When you imagine all your messages going through a single place, the ",[320,432,433],{},"ability to trace what happened to every single one of them"," (or a group of them) becomes a real challenge.",[295,436,437],{},"Even worse, one of the greatest challenges out there, even more in a distributed system, is the idempotence guarantee that we lacked so far on the other pipelines.",[295,439,440],{},[320,441,442],{},"Guaranteeing that a message cannot be sent twice is easier said than done!",[303,444,445,450],{"variant":305,"width":306},[291,446,447],{"v-slot:title":293},[295,448,449],{},"Design Thinking & Key Concepts",[291,451,452,459,465,487,493,513,519],{"v-slot:body":293},[295,453,454,455,458],{},"We split up our objectives into ",[320,456,457],{},"three main concepts that we promised to strictly respect"," to keep up with the constraints and guarantees of our platform.",[383,460,462],{"id":461},"reliability",[320,463,464],{},"Reliability",[466,467,468,475,481],"ul",{},[469,470,471,474],"li",{},[320,472,473],{},"Simple",": few share-(almost?)-nothing components",[469,476,477,480],{},[320,478,479],{},"Low coupling",": keep remote dependencies to its minimum",[469,482,483,486],{},[320,484,485],{},"Coding language",": efficient with explicit patterns and strict paradigms",[383,488,490],{"id":489},"scale",[320,491,492],{},"Scale",[466,494,495,501,507],{},[469,496,497,500],{},[320,498,499],{},"Application layer",": easy to deploy & scale with strong resilience",[469,502,503,506],{},[320,504,505],{},"Data bus",": high-throughput, highly-resilient, horizontally scalable, time and order preserving capabilities message bus",[469,508,509,512],{},[320,510,511],{},"Data querying",": low-latency, one-or-many query support",[383,514,516],{"id":515},"idempotence",[320,517,518],{},"Idempotence",[466,520,521],{},[469,522,523,526],{},[320,524,525],{},"Processing isolation",": workload distribution should be deterministic",[303,528,530,535],{"variant":305,"width":306,":image":529,"imagePosition":338},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F61cb7e47e7-ZJRtM55r-scylladb-2.jpg\",\"alt\":\"Diagram showing the default choice architecture featuring REST API Gateways and the central message routing platform\"}",[291,531,532],{"v-slot:title":293},[295,533,534],{},"Architecture considerations",[291,536,537,544,547,567],{"v-slot:body":293},[538,539,541],"h4",{"id":540},"the-possible-default-choice",[320,542,543],{},"The possible default choice",[295,545,546],{},"Considering Numberly’s stack, the first go-to architecture could have been something like this:",[466,548,549,552,555,558,561,564],{},[469,550,551],{},"Application layers running on Kubernetes",[469,553,554],{},"Kafka as a message passing bus from Gateway APIs",[469,556,557],{},"Kafka used as a log of messages to be processed and sent",[469,559,560],{},"ScyllaDB as a storage layer to query the state of individual or group of messages",[469,562,563],{},"Redis as a hot cache for some optimizations",[469,565,566],{},"Kafka used a messaging bus between our Central Message Routing Platform to individual channel routing agents",[295,568,569],{},[320,570,571],{},"On paper it sounds like a solid and proven design right?",[303,573,574,732],{"variant":305,"width":306},[291,575,576,582,587,599,605,611,618,644,649,655,663,669,675,681,692,698,704,707,717,720,729],{"v-slot:body":293},[295,577,578,579],{},"This apparently simple goto architecture has caveats that ",[320,580,581],{},"breaks too much of the concepts we promised to we stick with!",[383,583,585],{"id":584},"reliability-1",[320,586,464],{},[466,588,589],{},[469,590,591,594,595,598],{},[320,592,593],{},"High Availability with low coupling",": we would rely and need to design our reliability upon ",[320,596,597],{},"three different data technologies",", each of them could fail for different reasons that our platform logic should handle",[383,600,602],{"id":601},"scalability",[320,603,604],{},"Scalability",[295,606,607,608,362],{},"While we are lucky to dispose of a data technology to match each scalability constraint we set, ",[320,609,610],{},"the combination of the three does not match our reliability + idempotence requirements",[295,612,613,614,617],{},"Their combination adds too ",[320,615,616],{},"much complexity and point of failures to be efficiently implemented together",":",[466,619,620,626,632,638],{},[469,621,622,625],{},[320,623,624],{},"Easy to deploy",": Kubernetes would do the job alright",[469,627,628,631],{},[320,629,630],{},"Data horizontal scaling",": while ScyllaDB would scale for sure, Kafka scaling with its partitions logic is to be cautious about while Redis does not scale that well out of the box",[469,633,634,637],{},[320,635,636],{},"Data low latency querying",": ScyllaDB and Redis are the clear winners here while Kafka is obviously not designed to “query” a piece of data easily",[469,639,640,643],{},[320,641,642],{},"Data ordered bus",": that’s where Kafka excels and where Redis exposes a queuing capability that will scale hazardously. ScyllaDB on the other hand might be able to act as an ordered bus if we give it some thought?",[383,645,647],{"id":646},"idempotence-1",[320,648,518],{},[295,650,651,654],{},[320,652,653],{},"Idempotence as expected becomes a nightmare"," when you imagine achieving it on such a complex ecosystem mixing many technologies.",[466,656,657],{},[469,658,659,662],{},[320,660,661],{},"Deterministic workload distribution",": can you achieve it when summing ScyllaDB+Kafka+Redis?..",[538,664,666],{"id":665},"the-daring-architecture",[320,667,668],{},"The daring architecture",[295,670,671,672],{},"So we decided to be bold and make a big statement : ",[320,673,674],{},"we’ll only use ONE data technology to hold everything together!",[295,676,677,680],{},[320,678,679],{},"ScyllaDB"," was the best suited to face the challenge:",[466,682,683,686,689],{},[469,684,685],{},"It’s highly available",[469,687,688],{},"It scales amazingly",[469,690,691],{},"It offers ridiculously fast queries for both single and range queries",[295,693,694,695,362],{},"Which means that it can also be thought of as a distributed cache ",[320,696,697],{},"effectively replacing Redis",[295,699,700,703],{},[320,701,702],{},"Now replacing kafka as an ordered data bus is not so trivial using ScyllaDB"," but seems doable…",[295,705,706],{},"The biggest question still on our plate was:",[708,709,710],"blockquote",{},[466,711,712],{},[469,713,714],{},[320,715,716],{},"How can we get a deterministic workload distribution, if possible, for free?",[295,718,719],{},"That’s where I got what turned out to be a not so crazy idea after all:",[708,721,722],{},[466,723,724],{},[469,725,726],{},[320,727,728],{},"What if I used ScyllaDB’s shard-per-core architecture inside my own application?",[295,730,731],{},"Let’s take a quick detour and explain ScyllaDB shard-per-core architecture.",[291,733,734],{"v-slot:title":293},[735,736,738],"h2",{"id":737},"a-not-so-default-choice-after-all","A not so default choice after all",[303,740,743,748],{"variant":305,"width":306,":image":741,"imagePosition":338,"imageSize":742},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F424b3806ec-Ekosq8aZ-scylladb-3.jpg\",\"alt\":\"Diagram showing the ScyllaDB cluster, partition key shard calculation, and shards per core\"}","75%",[291,744,745],{"v-slot:title":293},[295,746,747],{},"ScyllaDB Shard-Per-Core Architecture",[291,749,750,756],{"v-slot:body":293},[295,751,752,753,362],{},"ScyllaDB low-level design leverages a shard-per-core architecture to ",[320,754,755],{},"deterministically distribute and process data",[295,757,758,759,762,763,766,767],{},"The main idea is that the ",[320,760,761],{},"partition key"," in your data table design ",[320,764,765],{},"determines not only which node is responsible for a copy of the data"," but also ",[320,768,769],{},"which CPU CORE gets to handle its I\u002FO processing.",[303,771,773],{"variant":305,"width":306,":image":772,"imagePosition":338,"imageSize":742},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002Ff5341868e2-T7YUMFEs-scylladb-4.jpg\",\"alt\":\"Diagram showing the ScyllaDB cluster, shards per core, and application pods\"}",[291,774,775,781,784],{"v-slot:body":293},[295,776,777,778],{},"You got it right, ",[320,779,780],{},"ScyllaDB distributes the data in a deterministic fashion down to a single CPU core!",[295,782,783],{},"So my naive idea was to distribute our messaging platform processing using the exact same logic of ScyllaDB:",[295,785,786,787,790],{},"The expected effect would be to actually ",[320,788,789],{},"align ScyllaDB’s per CPU core processing with our application’s"," and benefit from all the latency\u002Fscaling\u002Freliability that come with it.",[303,792,793],{"variant":305,"width":306},[291,794],{"v-slot:body":293},[303,796,797,802],{"variant":305,"width":306},[291,798,799],{"v-slot:title":293},[295,800,801],{},"The 100% Shard-Aware application",[291,803,804,811],{"v-slot:body":293},[295,805,806,807,810],{},"That’s how ",[320,808,809],{},"we effectively created a 100% shard-aware application",", and it brings amazing properties on the table!",[466,812,813,817,823,829],{},[469,814,815],{},[320,816,661],{},[469,818,819,822],{},[320,820,821],{},"Super optimized data processing"," capacity aligned from the application to the storage layer",[469,824,825,828],{},[320,826,827],{},"Strong latency and isolation guarantees"," per application instance (pod)",[469,830,831,834],{},[320,832,833],{},"Infinite scale"," following ScyllaDB’s own ability to grow seamlessly",[303,836,839,844],{"variant":305,"width":306,":image":837,"imagePosition":838,":fluidText":308},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F2a93a41246-ISxO8sTj-scylladb-5.png\",\"alt\":\"Diagram showing the first step of data ingestion\"}","right",[291,840,841],{"v-slot:title":293},[295,842,843],{},"Building a Shard-Aware Application",[291,845,846,852,860,874,880,886,892],{"v-slot:body":293},[383,847,849],{"id":848},"selecting-the-right-programming-language",[320,850,851],{},"Selecting the right programming language",[295,853,854,855,859],{},"Now that we got our architecture inspiration, it was time to answer the perpetual question “",[856,857,858],"em",{},"Which language to use?","”.",[466,861,862,868],{},[469,863,864,865],{},"We need a modern language that reflects our ",[320,866,867],{},"desire to build a reliable, secure and efficient platform",[469,869,870,871],{},"Shard calculation algorithm requires ",[320,872,873],{},"fast hashing capabilities and a great low-level synergy with the ScyllaDB driver",[295,875,876,877],{},"Once we established that, ",[320,878,879],{},"Rust was a no-brainer.",[383,881,883],{"id":882},"the-deterministic-data-ingestion",[320,884,885],{},"The Deterministic Data Ingestion",[295,887,888,889,362],{},"Incoming messages are handled by a component that we call the ",[320,890,891],{},"ingester",[295,893,894,895,898],{},"For each message we receive, after the usual validations, ",[320,896,897],{},"we calculate the shard to which the message belongs as it will be stored in ScyllaDB."," For this we use the ScyllaDB Rust driver internal functions (which we contributed).",[303,900,902],{"variant":305,"width":306,":image":901,":fluidText":308},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002Fd1f63be98e-fh4ZXdrw-scylladb-6.png\",\"alt\":\"Diagram showing the second step of data ingestion\"}",[291,903,904,914],{"v-slot:body":293},[295,905,906,907,910,911,362],{},"More exactly, ",[320,908,909],{},"we compute a partition key that matches the ScyllaDB’s storage replica nodes and CPU core"," from our message partition key effectively ",[320,912,913],{},"aligning our application’s processing with ScyllaDB’s CPU core",[295,915,916,917,920,921,924],{},"Once this partition key is calculated to match ScyllaDB’s storage layer, we persist the message with all its data in the ",[320,918,919],{},"message"," table and at the same time add its metadata to a table named ",[320,922,923],{},"buffer"," with the calculated partition key.",[303,926,928],{"variant":305,"width":306,":image":927,"imagePosition":338,"imageSize":742,":fluidText":308},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F075977b9ce-3BX4MZrK-scylladb-7.jpg\",\"alt\":\"Diagram showing the first step of deterministic data processing\"}",[291,929,930,936,942,948,954,958,962],{"v-slot:body":293},[383,931,933],{"id":932},"the-deterministic-data-processing",[320,934,935],{},"The Deterministic Data Processing",[295,937,938,939,362],{},"Now that the data is stored in ScyllaDB let’s talk about the second component which we call ",[320,940,941],{},"schedulers",[295,943,944,947],{},[320,945,946],{},"Schedulers will consume the ordered data from the buffer table"," and effectively proceed with the message routing logic.",[295,949,950,951],{},"Following the shard-to-component architecture, ",[320,952,953],{},"a scheduler will exclusively consume the messages of a specific shard just like a CPU core is assigned to a slice of ScyllaDB data.",[295,955,938,956,362],{},[320,957,941],{},[295,959,960,947],{},[320,961,946],{},[295,963,950,964],{},[320,965,953],{},[303,967,969],{"variant":305,"width":306,":image":968,"imagePosition":338,"imageSize":742},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F509d61faed-Arp6SXWU-scylladb-9.jpg\",\"alt\":\"Diagram showing the second step of deterministic data processing\"}",[291,970,971],{"v-slot:body":293},[295,972,973,976],{},[320,974,975],{},"A scheduler will fetch a slice of the data"," that it is responsible for it from the buffer table.",[303,978,980],{"variant":305,"width":306,":image":979,"imagePosition":338,"imageSize":742},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002Fa4f32f2825-dLb4SegK-scylladb-10.jpg\",\"alt\":\"Diagram showing the first third of deterministic data processing\"}",[291,981,982],{"v-slot:body":293},[295,983,984,985],{},"At this point, a scheduler will have the ids of the messages it should process. ",[320,986,987],{},"Then it fetches the message details from the message table.",[303,989,991],{"variant":305,"width":306,":image":990,"imagePosition":338,"imageSize":742},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002Fc62c22c068-qk27srGK-scylladb-11.jpg\",\"alt\":\"Diagram showing the fourth step of deterministic data processing\"}",[291,992,993],{"v-slot:body":293},[295,994,995,996,362],{},"The scheduler then process and ",[320,997,998],{},"send the message to the right channel it is responsible for",[303,1000,1002],{"variant":305,"width":306,":image":1001,"imagePosition":338,"imageSize":742,":fluidText":308},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002Fa08383df2f-0VjCzgfn-scylladb-12.png\",\"alt\":\"Diagram showing the replacement of Kafka with ScyllaDB\"}",[291,1003,1004,1010,1016,1022,1028,1038],{"v-slot:body":293},[295,1005,1006,1009],{},[320,1007,1008],{},"Each component of the platform is responsible for a slice of messages per channel by leveraging on ScyllaDB’s shard-aware algorithm."," We obtain a 100% aligned data processing from the application’s perspective down to the database.",[383,1011,1013],{"id":1012},"replacing-kafka-with-scylladb",[320,1014,1015],{},"Replacing Kafka with ScyllaDB",[295,1017,1018,1021],{},[320,1019,1020],{},"Replacing Kafka as an ordered data bus is not so trivial using ScyllaDB"," but was surely doable.",[295,1023,1024,1025,362],{},"Let’s get a deeper view on ",[320,1026,1027],{},"how it works from the scheduler component perspective",[295,1029,1030,1033,1034,1037],{},[320,1031,1032],{},"We store messages metadata as a time series"," in the the buffer table, ordered by their ScyllaDB’s time of ingestion (this is an important detail). ",[320,1035,1036],{},"Each scheduler keeps a timestamp offset"," of the last message it successfully processed.",[295,1039,1040,1043],{},[320,1041,1042],{},"This offset is stored in dedicated table",". When a scheduler starts it fetches the timestamp offset of the shard of data it is assigned to.",[303,1045,1047],{"variant":305,"width":306,":image":1046,":fluidText":308},"{\"src\":\"\u002Fcms\u002Fmigration\u002Fposts\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F306684ce8e-eYYs42GP-scylladb-13.jpg\",\"alt\":\"Diagram showing the replacement of Kafka with ScyllaDB\"}",[291,1048,1049,1055,1061,1068],{"v-slot:body":293},[295,1050,1051,1052,362],{},"A scheduler is an infinite loop ",[320,1053,1054],{},"fetching the messages it is assigned to within a certain and configurable time window",[295,1056,1057,1058,362],{},"In fact, a scheduler doesn’t fetch data strictly starting from the last timestamp offset ",[320,1059,1060],{},"but instead from an oldest timestamp",[295,1062,1063,1064,1067],{},"It does indeed mean that a single message will be fetched multiple times but ",[320,1065,1066],{},"this is handled by our idempotence business logic and optimized"," by a memory cache.",[295,1069,1070,1071,1074],{},"Overlapping the previous time range allows us to prevent any possible ",[320,1072,1073],{},"message miss that could be caused by a potential write latency or subtle time skew between nodes"," (since we rely on ScyllaDB’s timestamps).",[303,1076,1077,1260],{"variant":305,"width":306},[291,1078,1079,1085,1091,1097,1103,1106,1112,1123,1130,1136,1143,1149,1186,1189,1192,1198,1204,1210,1216,1226,1229,1235,1241,1251,1257],{"v-slot:body":293},[295,1080,1081,1082,362],{},"Reaching our goal was not easy, we failed many times but finally made it and proved that our original idea was not only working but also was ",[320,1083,1084],{},"very convenient to work with while being amazingly efficient",[383,1086,1088],{"id":1087},"what-we-learned-on-the-road",[320,1089,1090],{},"What we learned on the road",[295,1092,1093,1094,362],{},"The first thing we want to emphasize is that ",[320,1095,1096],{},"load testing is more than useful",[295,1098,1099,1100,362],{},"Quickly enough during the development, we set up load tests, sending dozens of thousands message per second. ",[320,1101,1102],{},"Our goal was to test our data schema design at scale and idempotence guarantee",[295,1104,1105],{},"It allowed us to spot multiple issues, sometimes non trivial, like when the execution delay between the statements of our insertion batch was greater than our fetch time-window. Yeah, a nightmare to debug…",[295,1107,1108,1109],{},"By the way, our first workload was a naive insert-and-delete, and ",[320,1110,1111],{},"load testing made large partitions appear very fast!",[295,1113,1114,1115,1118,1119,1122],{},"Hopefully, ",[320,1116,1117],{},"we also learned about compaction strategies",", and especially the ",[320,1120,1121],{},"Time-Window Compaction Strategy",", which we are using now, and which allowed us to get rid of the large partitions issue.",[295,1124,1125,1126,1129],{},"Message buffering as time-series processing allowed us to ",[320,1127,1128],{},"avoid large partitions","!",[383,1131,1133],{"id":1132},"we-contributed-to-the-scylladb-rust-driver",[320,1134,1135],{},"We contributed to the ScyllaDB Rust driver",[295,1137,1138,1139,1142],{},"To make this project possible, ",[320,1140,1141],{},"we contributed to the ScyllaDB ecosystem",", especially to the Rust driver, with a few issues and pull requests.",[295,1144,1145,1146],{},"For example, ",[320,1147,1148],{},"we added the code to compute the replica nodes of a primary key, as we needed it to compute the shard of a message:",[466,1150,1151,1158,1165,1172,1179],{},[469,1152,1153],{},[323,1154,1157],{"href":1155,"rel":1156},"https:\u002F\u002Fgithub.com\u002Fscylladb\u002Fscylla-rust-driver\u002Fpull\u002F436",[327],"optimize PreparedStatement::compute_partition_key",[469,1159,1160],{},[323,1161,1164],{"href":1162,"rel":1163},"https:\u002F\u002Fgithub.com\u002Fscylladb\u002Fscylla-rust-driver\u002Fpull\u002F484",[327],"add ClusterData::get_endpoints",[469,1166,1167],{},[323,1168,1171],{"href":1169,"rel":1170},"https:\u002F\u002Fgithub.com\u002Fscylladb\u002Fscylla-rust-driver\u002Fpull\u002F485",[327],"connection_pool\u002Fnode: expose node sharder",[469,1173,1174],{},[323,1175,1178],{"href":1176,"rel":1177},"https:\u002F\u002Fgithub.com\u002Fscylladb\u002Fscylla-rust-driver\u002Fpull\u002F576",[327],"session: add keyspaces_to_fetch configuration",[469,1180,1181],{},[323,1182,1185],{"href":1183,"rel":1184},"https:\u002F\u002Fgithub.com\u002Fscylladb\u002Fscylla-rust-driver\u002Fissues\u002F571",[327],"zero-copy and lazy rows deserialization enhancement",[295,1187,1188],{},"We hope it will help you if you want to use this cool sharding pattern in your future shard-aware application!",[295,1190,1191],{},"We also discovered some ScyllaDB bugs, so of course we worked with ScyllaDB support to have them fixed (thanks for your reactivity).",[383,1193,1195],{"id":1194},"what-we-wish-we-could-do",[320,1196,1197],{},"What we wish we could do",[295,1199,1200,1201,362],{},"As in all systems, everything is not perfect, and we have some points ",[320,1202,1203],{},"we wish we could do better",[295,1205,1206,1209],{},[320,1207,1208],{},"Obviously, ScyllaDB is not a message queuing platform, and we miss Kafka long-polling",". Currently, our architecture does regular fetching of each shard buffer, so that’s a lot of useless bandwidth consumed, but we are working on optimizing this.",[295,1211,1212,1213,362],{},"Also, we encountered some memory issues, where we did suspect the ScyllaDB Rust driver. We didn’t take so much time to investigate, but it made us dig into the driver code, where ",[320,1214,1215],{},"we spotted a lot of memory allocations",[295,1217,1218,1219,362],{},"As a side project, we started to think about some optimizations; actually, we did more than think, because we wrote ",[320,1220,1221],{},[323,1222,1225],{"href":1223,"rel":1224},"https:\u002F\u002Fgithub.com\u002Fwyfo\u002Fscylla2",[327],"a whole prototype of an (almost) allocation-free ScyllaDB Rust driver",[295,1227,1228],{},"We will maybe make it the subject of a future blog post, with the Rust driver outperforming back the Go driver!",[383,1230,1232],{"id":1231},"going-further-with-scylladb-features",[320,1233,1234],{},"Going further with ScyllaDB features",[295,1236,1237,1238,362],{},"So we bet on ScyllaDB, and that’s a good thing, because ",[320,1239,1240],{},"it has a lot of other features that we want to benefit from",[295,1242,1243,1244,1247,1248,362],{},"For example ",[320,1245,1246],{},"Change Data Capture:"," using the CDC Kafka source connector, we could stream our message events to the rest of the infrastructure, without touching our application code. ",[320,1249,1250],{},"Observability made easy",[295,1252,1253,1254,362],{},"We are looking forward to the ScyllaDB path towards ",[320,1255,1256],{},"strongly consistent tables with Raft as an alternative to LWT",[295,1258,1259],{},"Currently, we are using LWT in a few places, especially for dynamic shard workload attribution, so we can’t wait to test this feature!",[291,1261,1262],{"v-slot:title":293},[383,1263,1265],{"id":1264},"retrospective","Retrospective",[1267,1268,1270],"insight-related",{"mode":1269},"automatic",[291,1271,1272],{"v-slot:title":293},[295,1273,1274],{},"You may also like",{"title":293,"searchDepth":1276,"depth":1276,"links":1277},2,[],"insights-events","award",false,null,"Award",{"id":1284,"type":1285,"url":1286},37000,"post","https:\u002F\u002Fnumberly.dev\u002Fen\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust\u002F",{},true,"\u002Fen\u002Finsights-events\u002Fposts\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust","2023-03-08T09:03:33",{"title":278,"description":301},{"loc":1289,"videos":1293,"images":1294},[],[],"en\u002Finsights-events\u002Fposts\u002Fbuilding-a-100-scylladb-shard-aware-application-using-rust",[1297],"data-marketing",{"fr":1299,"en":1300},"construire-une-application-100-scylladb-shard-aware-en-utilisant-rust","building-a-100-scylladb-shard-aware-application-using-rust","uTTwGwsxlON6KfGiUQmfKXREu1Ew0gwBZNbaoCk8mjY",[],[1304],{"path":1305,"title":1306},"\u002Fen\u002Finsights-events","Insights & Events | Numberly",[1308,1322,1328,1332,1337],{"to":1309,"category":1310,"capability":-1,"chip":-1,"title":1311,"description":1312,"publishedAt":-1,"readingTimeMinutes":-1,"logo":-1,"thumbnail":-1,"event":1313,"matchReason":1321},"\u002Fen\u002Finsights-events\u002Fevents\u002Fthe-priceless-value-of-data-for-the-health-industry","event","The priceless value of Data for the Health industry","With Pierre Fabre, Withings, MSD & Janssen",{"kind":1314,"timeline":1315,"city":-1,"formats":1319},"webinar",{"timeZone":1316,"start":1317,"end":1318},"Europe\u002FParis",1643040025000,1643043625000,[1320],"online","level_2_tag_relevance",{"to":1323,"category":1324,"capability":-1,"chip":-1,"title":1325,"description":1326,"publishedAt":-1,"readingTimeMinutes":-1,"logo":1327,"thumbnail":-1,"event":-1,"matchReason":1321},"\u002Fen\u002Finsights-events\u002Fuse-cases\u002Fconducting-digital-maturity-assessment-to-help-focus-on-value-generating-initiatives","use-case","Conducting digital maturity assessment to help focus on value generating initiatives","Our work for Qorus","\u002FUntitled-September-21,-2026-at-10.52.53-2.png",{"to":1329,"category":1324,"capability":-1,"chip":-1,"title":1330,"description":1331,"publishedAt":-1,"readingTimeMinutes":-1,"logo":-1,"thumbnail":-1,"event":-1,"matchReason":1321},"\u002Fen\u002Finsights-events\u002Fuse-cases\u002Fdelivering-synergies-from-optimized-agile-organizational-governance-model","Delivering Synergies from Optimized Agile Organizational & Governance Model","Our work for a leading biotechnology actor",{"to":1333,"category":1324,"capability":-1,"chip":-1,"title":1334,"description":1335,"publishedAt":-1,"readingTimeMinutes":-1,"logo":1336,"thumbnail":-1,"event":-1,"matchReason":1321},"\u002Fen\u002Finsights-events\u002Fuse-cases\u002Firobot-customer-profiling-study-using-amazon-data","iRobot customer profiling study using Amazon data","Discover our use case with iRobot!","\u002Fcms\u002Fmigration\u002Finsights\u002Fen\u002Firobot-customer-profiling-study-using-amazon-data\u002Fd4da6bcd0e-2gD5aldc-logo-irobot.png",{"to":1338,"category":1324,"capability":-1,"chip":-1,"title":1339,"description":1340,"publishedAt":-1,"readingTimeMinutes":-1,"logo":-1,"thumbnail":-1,"event":-1,"matchReason":1321},"\u002Fen\u002Finsights-events\u002Fuse-cases\u002Fleveraging-data-insights-to-design-a-tailor-made-loyalty-program-that-maximizes-value-generation-from-segment-migration","Leveraging data insights to design a tailor-made loyalty program that maximizes value generation from segment migration","Our work for a leading Champagne maison",1796221705512]