At AO.com, our team have been focussing on how we can develop new capabilities delivering business value whilst decoupling from legacy monolithic architectures. The problem is, our existing applications contain a lot of data that we care about.
8. A single customer view is an aggregated,
consistent and holistic representation of the data
held by an organisation about its customers that
can be viewed in one place, such as a single
page.
Wikipedia [https://en.wikipedia.org/wiki/Single_customer_view]
30. public IEnumerable<T> Find(string fieldName, int entityId, int maxNumberOfTimesProcessed, int limitToReturn)
{
var filter = new BsonDocument
{
{ Numberoftimesprocessed, new BsonDocument("$lt", maxNumberOfTimesProcessed) },
{ fieldName, new BsonDocument("$gte", entityId) }
};
var sort = new BsonDocument(fieldName, 1);
IAsyncCursor<T> query = _database.GetCollection<T>(_collectionName).Find(filter).Sort(sort)
.Limit(limitToReturn).ToCursor();
return query.ToList();
}
Use native query language
36. public LambdaConstructor()
{
var secretManager = new SecretManager(new ConfigurationManager());
var mongoDb =
JsonConvert.DeserializeObject<MongoConnectionString>(
secretManager.Get(Environment.GetEnvironmentVariable("SECRET_NAME")));
var mongoClient = new MongoClient(mongoDb.ConnectionString);
var mongoDatabase =
mongoClient.GetDatabase(Environment.GetEnvironmentVariable("MONGODB_GDPR_SUPPRESSION_COLLECTION"));
var pack = new ConventionPack {new CamelCaseElementNameConvention(), new IgnoreIfNullConvention(true)};
ConventionRegistry.Register("camel case",
pack,
t => true);
}
MongoDB once in Lambda
Serverless development with Node.js, AWS Lambda and MongoDB Atlas
https://bit.ly/2HrOGYX
Directors story
Title, looking at
Steps to data platform
Lessons learned MongoDB
Lessons learned Serverless
Key message
Introduce
About me
Books
Team
Firstly
Secondly
Who are AO (northern values)
Part of a growing tech scene in Manchester and proud members of Norther Powerhouse
True north – We want the happiest customers, and we do that by relentlessly striving for a better way
We go back to the story we started with
This is why Single Customer View!
Talk outline
Rates of data
Usually lots of Hidden value
Get to it via analysing historical or reacting as it’s generated
Challenges of getting it -> ETL
New data – traditional ways of getting out
AO.com data
Team Mission
Building the single customer view
What is SCV?
Questions
Big pool of data?
What data is appropriate?
What’s a customer, someone who’s transaction?
Understand where it came from
Most value when it’s hot
Producing data all the time (Website, call centre, order processing)
Comes from (SQL Server, queues, clickstream)
Look for advantage when data is hottest
Principles
DevOps
Coupling
Stream processing
Infrastructure as code and as few servers as possible
Evolvable data schema
Tech Stack
Cloud native AWS
.net core
Host in docker and lambda
Deploy using terraform and serverless framework
Stream data using Apache Kafka with Confluent OSS (only thing that needs servers)
MongoDB to build context specific materialised views
Hosted in Atlas
Why MongoDB?
[PAUSE]
First options
Tech enables
Data sources means NoSql
MongoDB
Developer friendly
No mapping code, no ORM
Drivers
Fast
Atlas
Outline the slides SQL – CDC – Kafka – Consumer – MongoDB
Stage two – release from MongoDB
Bigger text
Key over the next few slides – describe the key
- First challenge - Reduce risk of coupling
- CDC (used in replication)
- Kafka connect – more protection (open source)
- Talk through the slide (better detail)
- Command line
- Explain what’s happening on the slide
- Recap on what we’ve done
Why does the data look funny?
Introduce the key
Avro
Avro and Schema Registry
Example of C#
Language doesn’t matter
Strategy
Talk through the slide
Deserialize schema reg
Build single customer
Save to repo
If we switch to MongoDB atlas, for us, this means constructing the Single Customer View from the incoming customer stream.
- Show the SCV object – talk through where we’re adding data
If we switch to MongoDB atlas, for us, this means constructing the Single Customer View from the incoming customer stream.
- Show the SCV object – talk through where we’re adding data
Power of approach
- Construct and push to Kafka
- Self fulfilling system
- ASIDE : Change streams
Quick recap
This approach allowed us to get to production in less than three months
Portal for our fraud team to give the personal touch
GDPR client
Got the building blocks for our Single Customer View platform in place
Lessons learned so far
Early issues (batching, paging) – basically, query composition… there is a great talk coming up later on avoiding common query pitfalls, I think we could have done with that earlier
WHO LIKES ALERTS?
You can see the alert and the graph both show that query targeting is a problem. This means our index either wasn’t correct or wasn’t being used.
Talk through slide
Team story
MongoDB support
Extension of the team when trying to solve problems
Follow up after resolution with our customer care representative – find out more in Vladis talk
In this instance, we needed to get our thinking caps on, this normally results in head scratching, and white boarding sessions
- LINQ
- Aggregation framework
- Explain command
Using Linq because?
Recommend native query language
Talk through slide
_id
Duplicated indexes (makes _id redundant)
Duplicated disk space
Keep an eye out
Projection
Customers transacting a lot
Does anybody here use AWS and Lambdas?
[PAUSE]
Story on serverless
Team principle – as few servers as possible
Serverless architectures promise:
No servers to manage
Continuous scaling and balancing
Automatic fail-over
Paying only for what we use
As a team we were sold, ready to go
And my manager was happy too
What could go wrong?
We have a couple of gotchas to watch out for if you go down this route.
Cold starts (Adding RAM)
VPC Peering and Atlas (good)
VPC Peering and Atlas (bad)
- Cache database in lambda for reuse
C# constructor
Also a great blog post on MongoDB.com for node
Benefits of serverless
Using serverless and MongoDB Atlas GDPR
A recent blog post by Jeremy Daly says that serverless microservices should at least adhere to the following standards:
Services should have their own private data
Be independently deployable
Utilise eventual consistency
Use async workloads wherever possible
And finally, our services should be small, but valuable
- How does this help?
- Recap
- Decoupled services
- Lessons learned
So I want to ask the question again, what is Single Customer View. What does it mean to achieve this?
[PAUSE]
Initial thoughts
I believe (unique customer experiences)
Legacy does this
Data trapped in legacy data layers as seed innovation and experimentation
Kafka
Mongodb
This allows us to produce ever richer data applications in a safe way. It allows us to experiment with hypothesis where we can pull in the data and verify it works.
If it doesn’t we have the opportunity to iterate quickly and release something that moves closer to where we want to be.
- More often == richer
- Ecosystem to drive new innovations
- Continue to publish into this ecosystem
Enable thinking
Embrace as differentiator
Few lines of code (building rather than managing)
Get to production quickly, meet objectives quickly
Our team mission evolved:
Getting data to the right teams
Increasing customer safety, well-being and ultimately happiness
I believe that we have unlocked some really powerful concepts, which has set us up to build new applications that will help us succeed and thrive in the future.
We’ve unlocked data from legacy applications and data stores
We’ve decoupled teams to increase delivery frequency
We’ve embraced technology as a differentiator to give our customers a better experience
And, we’ve given ourselves the opportunity to capture stories like the one we started with.
I still feel that we’re at the start of our journey with the possibilities of the Single Customer View project at AO.
I believe we’re building an architecture and platform that will truly allow us to build applications that genuinely help and improve our customer journey and we’re very excited at what lies ahead.
Thank you
- Start of journey