The data generated by a million parcels a day is categorized into two main types: events and master data. The former includes all parcel-related activities, from the initial request to delivery progress, including successful or missed deliveries and alternative pick-up options. The latter includes globally applicable information such as addresses, postcodes, and delivery zones, the essential components for successful parcel sorting. Both are now stored in MongoDB.
To efficiently manage parcel information, Swiss Post now stores all data related to a piece of mail in a single document, using MongoDB's flexible schema collections. This approach allows Swiss Post to quickly process and route parcels on sorting machines. The MongoDB time-to-live index automatically deletes old mail pieces after 30 days, streamlining data management without manual cleanup.
To aid diagnostics and recovery, Swiss Post takes regular snapshots of master data, helping identify the state of data and allowing a rollback to previous versions if current data is corrupt. To manage this efficiently, the team uses partitioning in MongoDB, which supports seamless data updates without impacting performance. Snapshots are published on Kafka, consumed, and then switched to new collections, with old ones periodically cleaned up.
“MongoDB Atlas plays a crucial role here,” said Jean-Richard. “We rely on it to access our clusters and build the next generation of software solutions.”
OUTCOME
Continuous integration and deployment enable quicker time to market
The adoption of MongoDB has helped transform Swiss Post operations. Rather than four major software releases a year, a DevOps approach sees up to six releases a day and creates a cadence of continuous improvement. Database responsiveness is up by 67%. Riedo and Jean-Richard say this leap in productivity has been made while reducing development costs.
Pipelines and testing are fully automated, with 100% coverage of every line of code on different levels of testing.
“This change has enabled us to reduce the time to market to levels we couldn’t get near with the old system,” said Riedo. “We’re currently deploying roughly 300 times more per year.”
The ability of MongoDB to scale quickly has helped accelerate the modernization of sorting center operations. The team needed to load considerable data from Kafka as each sorting center was integrated. “We were able, for a very short time, to scale up our cluster to support the migration,” said Riedo. “And then for the normal load, we could scale it down again to the level it will remain. We greatly appreciated that flexibility.” “Now, adding a new sorting center doesn’t worry me. I know we can scale our services and scale up MongoDB.”
The aim is to have all sorting centers running on MongoDB within a year. MongoDB’s performance and analysis tools enabled the team to identify slow queries and missing indexes, something they feel other solutions might not have revealed. As a result, performance bottlenecks are rare and easily fixed. For Jean-Richard, predictability has been a key benefit: “It's clear how MongoDB is going to behave. There are no random events, no sudden slowing down. We can rely on it.”
For example, when using a relational database, it was a daily occurrence to experience slow queries with no one knowing the reason. “You just had to live with it, and hope for the best,” he added. “These types of things don’t happen with MongoDB Atlas. You know what to expect.”