Designing Layered APIs for Real-Time Matrix PricingDesigning Layered APIs for Real-Time Matrix Pricing
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
how i ensured seamless user experience with fast api response in really heavy requests and where we should get instant api response: On the gaming boost platform that i have built, the real challenge was implementing complex matrix pricing that works in real time without using websockets ofc
i ensured really fast reponses (RT<3ms) by doing this three steps: 1- First of all understanding client needs and the importance of instant response for optimal user experience. 2- Defining the problem in small steps: in technical side i implemented this on 3 layers First one is the service layer : the easiest and the light one on size, it fetches the simple content like title, description, FAQs ..... Second Layer : Defining the difference between a service that needs going from point A to point B and this can be done by : linear steps, dropdowns, or slider which accepts 2 values. This is simply can be done via a boolean variable. So a service will only fetch what is on layer 1 + simple boolean variable Third Layer: This layer will exist only if the boolean is on true, so to go from A to B we should ensure that Last point is > than first point, and we need price from A to B, A to C , B to C and so on...., so the solution was a upper triangular matrix with two parameters (price and required time). So fetching a service that needs this type of pricing will go through those 3 layer, last layer will be fetched depending on the values of 2 body parameters - each api call is dedicated only to get that price and time so very small payload, so each client change will be reflected instantly, but if all the things were implemented in same layer, so loading time will be insane espacially in high traffic.
Post image
Post image
Post image
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started