A Different Type of
Supermarket Delivery
Phil Jenkins
About Me
● Developer
● 14 years of coding
● Career motto: “Try anything once”
● When not coding, I like to cycle
Background
The Client
One of the largest supermarkets in the UK
● £Billions in revenue
● 1000s of UK stores
● Online / In store channels
Client Vision
Enterprise APIs
● Take ownership of business logic
● Standardise
● Replace the till
● Flexibility for the customer
Motivation
Enterprise APIs
Pricing / Quoting Identity Customer
Segregation by business function
BUSINESS CRITICAL SERVICES
Enter ThoughtWorks
Enterprise APIs
Cloud-based services
Pricing / Quoting Identity Customer
Enterprise APIs
Cloud-based services
Pricing / Quoting Identity Customer
Pricing API
Tech Stack
Pricing API
Initial solution
HTTP
Events
Store
However...
Store
However...
● Network performance is poor
○ 60 mins downtime per store per month
● Most stores have a single point of failure
● The customer must ALWAYS be able to check out
THE ONLY PLACE FOR BUSINESS CRITICAL SERVICES
IS THE TILL ITSELF
Plan
● Till ALWAYS talks to a local Pricing API
● Events are stored in embedded DB
● Background sync to central
● Run in parallel
Store
Offline
Online
Sync Events
Store
40000
Rule of Tills
For 𝑖=1,…, 𝑛
40000i = A big number
Rule of Tills
● 15MB of logs per till per day
● 15MB x 40000 = ~ 600GB logs per day
Tills
Deployment
Methods
“Till Build”
OS and core applications installed by engineer on site Slow release cycle
Enterprise Software Management
CA DSM / Nolio etc. No standard tool
“Spider”
Methods
Written by Till Deployment team
Already running in till estate
P2P distribution in store
“Spider”
The End
Pain
App
Store Store
Store
Store
StoreStore
Store
Store
Store
Store
Every Morning
Rethink
Service
HTTP
Service
Service
Service
Guiding Principles
Central Service
● Logic goes here
● Scalable
● Cheap
Till Clients
● Low overhead
● Convention-based
● Bootstrap once
● Self-updating
Lambda
API Gateway
Apigee
S3HTTP Endpoint
Rate Limiting
Artefacts and
Manifest
Application Logic
Manifest
Till Type
Till
Store
Mapping application versions to
devices
Manifest
{
stores: {
A: 1.5,
B: 1.4
}
}
{
store: A,
till: 2,
version: 1.0
}
Service
302
https://url/v1.5.zip
Manifest
{
stores: {
A: 1.5,
B: 1.4
}
}
Service
Manifest
{
stores: {
A: 1.5,
B: 1.4
}
}
{
store: A,
till: 2,
version: 1.5
}
Service
304
Manifest
{
stores: {
A: 1.5,
B: 1.4
}
}
Service
Batch
scripts
Scheduled Task
Tools
(dunzip, fciv)
curl
HTTP Client
Orchestration
Execution
Unzipping,
Checksumming
Rule of Tills
For 𝑖=1,…,𝑛
40000i = A big number
Rule of Tills
● Pricing API: 40MB
● 40000 x 40MB = 1.6TB to distribute!
● Bandwidth considerations
○ 500 Mbps centrally
○ 6 Mbps in store
03:00 -
04:00 -
05:00 -
06:00 -
07:00 -
08:00 -
18:00 -
19:00 -
20:00 -
21:00 -
22:00 -
23:00 -
Scheduling
00:00 -
01:00 -
02:00 -
Deltas
● Only send changes
● Explode JARs
● Diff in Lambda
● > 40x smaller!
V1.0 V1.1
V1.0 --> V1.1
Success!
Lessons
1. The network is reliable
2. Latency is zero
3. Bandwidth is infinite
4. The network is secure
5. Topology doesn't change
6. There is one administrator
7. Transport cost is zero
8. The network is homogeneous L Peter Deutsch
So true...
Fallacies of Distributed Computing
!??
Back to Basics
● Be pragmatic!
● Do one thing well
● Concepts over tools
Till the next time
Thank you

A differnt Type of Supermarket Delivery