India’s First Instant Print Store
Leveraging IoT to deliver printouts to your doorstep
Setting up our Printout Delivery Store has been highly satisfying. At one end is the joy of customers discovering an easy, home-delivered solution for last-minute printouts. But even more enjoyable is the knowledge that we created a nationwide service with only a Raspberry Pi and a seamless print flow that effectively harnesses the power of our instant delivery.
But we did face some challenges along the way. Post-launch, our customers started experiencing many consistency issues, which had to be fixed before we could scale this service. These challenges stemmed from fundamental hardware limitations. Combined with a need for data privacy and security, it led to frequent misses. The root causes were silly things, such as printers not connecting to the Internet, going to sleep, running out of paper, etc. Below are ways we tackled them and made the instant print store a success.
What did we need to do?
We needed to figure out how to tinker with our existing microservices to integrate them with the Print Store. Hence we set aside the following objectives:
- Automation: Start the print process once the order has cleared its payment without manual intervention.
- Security: Delete the files as soon as the print is complete.
- Agile Response System: Build a detection mechanism to act quickly on issues such as paper jams and low toner levels
- 99.9% Uptime: Have No service downtime whatsoever.
Selecting our Hardware — Slice of Pi
We needed inexpensive, IoT-friendly hardware, naturally drawing us to the lean, mean, fruity machine–The Raspberry Pi.
The Pi is the epitome of commodity computing. It’s cost-effective, energy-efficient, easy to set up, and has a ton of support for peripheral connectivity. With the Raspberry Pi, we can also sandbox and package our services to be deployed remotely nationwide.
Our Software Implementation
Store Printing Controller Service
This service is the heart of our operation and runs on our Pi Zeros (running Raspbian OS), plugged into our local printers. It runs bare metal on our Pi hardware, which allows us to scale up and maintain parity among hardware devices.
So, when a customer uploads a document for printing, this service receives data from our backend services, temporarily stores it, and passes it on appropriately. Commands are received in JSON, which are then converted into printer actions such as “double-sided print,” “color print,” and “A4”.
Since the printer cannot send telemetry data to our servers, the controller service handles it. It’s also responsible for retry policies and hardware recovery in case of failures. Our service can also receive binary updates on the fly and over the air, which ensures minimal manual intervention. Building this capability to update remotely is crucial when running a centralized operation pan-India.
Proxy Printing Service
We had to develop middleware that would maintain the persistence of the data sent by the controller. This middleware, our proxy printing service, is in charge of printing all documents. It structures the data from the controller service, queues it, and sends it back to the printing service with retries when needed.
Our Proxy Printing Service is isolated from the Pi and our microservices. This is essentially an insular service with no external awareness and no business intelligence residing here. In fact, this also allows us to package the print store and integrate it with our app.
Printing Service
The Printing Service handles all system-level intelligence and business logic, while the proxy and controller services handle printing. Our Printing Service contains the queueing logic and routes printing requests to the correct local stores.
This service maintains Google’s Remote Procedure Calls or the gRPC framework to connect our internal microservice to our store printing controller. The printer service keeps connections socket-based and exposes endpoints to our internal operations. It also stores the controller’s telemetry and publishes it to a message broker.
Final Touches
Data privacy and security have always been Blinkit’s priority. Given that the Print Store would be handling our customers’ confidential documents, we built the entire operation to ensure that misuse of information was not possible. We developed a secure printing feature that deletes files as soon as they are printed. While we had the option to provide the convenience of maintaining documents for re-printing, we consciously forewent that option. So, if you need to print the same document again (we allow multiple copies in the same order), you will have to upload the document to the print service again, which will get deleted as soon as the print is complete.
What did we create?
We received a ton of customer love for this service–when you really need a print, you really need it. People mentioned that they were using the print store to print visa documents, boarding passes, assignments, and even memes!
We’ve started working on support for passport photos and even t-shirt and poster printing. When this goes live, we’ll be there for all your last-minute printout needs and customised gifts for your loved ones.