darkua / json_delta Goto Github PK
View Code? Open in Web Editor NEWa service that tracks json model changes and lists them
a service that tracks json model changes and lists them
Do you care about HTTP semantic?
Hello,
Somewhere down the line, this service is deployed/delivered via several machines and has a considerable load. It will also need to have its persistence somewhere else. Because of some reasons that you cannot control, you start receiving duplicate requests for the same data. For example:
// request 1
{
"_id": 1,
"transactionId": "tx1",
"name": "Bruce Willis",
"address": {
"street": "Nakatomi Plaza"
}
}
// request 2
{
"_id": 1,
"transactionId": "tx1",
"name": "Bruce Willis",
"address": {
"street": "Nakatomi Plaza"
}
The systems that send these requests, also started sending a transactionId
that allows you to detect they are duplicate. For some more reasons, it's very problematic business wise to store duplicate data. You can only store one, even if you receive may. And all those many requests can be delivered at exactly the same time.
Can you elaborate on an approach to this?
Imagine that for some reason you team decide to have different databases per environment. For example, memory db for tests mode and postgres for dev, staging and production. How would you improve your solution to be better prepared for this change? What would be your approach?
Hello,
Thanks for making our challenge! It's always interesting to see new approaches to the problem and to learn from it. :)
Now the team will leave some questions and provide some feedback. Here is my first one. To filter by the dates, you do:
return _.filter(elements, function(item) {
return item._timestamp >= startDate && item._timestamp < endDate
})
Imagine that elements is a very huge collection. How could you replace this loop for something faster?
What are the implications of having a CPU heavy operation like that on a request? What would happen to the server?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.