29: Amazon Payment Gateway | Systems Design Interview Questions With Ex-Google SWE

preview_player
Показать описание
That's right, my payments DB is strongly consistent so I'm never gonna lose track of who bought those foot pics
Рекомендации по теме
Комментарии
Автор

13:44 vs 23:38, request to stripe is from payment service or from client browser? Is it correct that the confirmation page is actually generated from stripe and shows up in browser as an iframe inside payment ?service UI

gordonli
Автор

Hey Jordan, instead of maintaining a cache of pending payments to handle the scenario where our web hook server goes down, would a placing a message in a queue when the web hook is called be sufficient?

The pros
- We don't need to configure a cdc
- We don't need to poll and determine the right parameters for it

The cons
- We're depending on Stripe to at least call our web hook once for each payment

At least for the con I mentioned, we could have a cron job, say every hour look through our pending payments table.

itsslo
Автор

17:18 – should pending payments that are `not recognized` by stripe at poll time really just be deleted from the payments table? this case might require special processing since at this point, the payment has a local DB status of `pending` but stripe has not recognized this payment. What would be a possible solution for this inconsistency?

udaypatel
Автор

The action of deleting the pending payment in database when receiving un-recognized result from stripe potentially leads to inconsistency when your request is still in network route and has not yet reached stripe server at the time the poller check. After deleting the record in DB, the request comes into stripe and modify your bank balance. How to solve this problem completely

nhancu
Автор

I suggest building a state machine/FSM for the overall flow of the process in the state machine for easily transitioning from start->progress -> success or retry or failure. This also allows you to implement multiple payment gateways using a strategy pattern.

arvindgb
Автор

I have a dumb question. Why would row read locks on the pending payments slow down the write throughput of the table, given the writes' idempotency key are different from the pending ones?

DivyanshRana
Автор

This is literally what I needed today. Cramming this playlist hopefully offer pulls up, I never comment on posts but u are the goat bro the goat broski if I get this offer I will send u some only fans money

tejasvenky
Автор

How does Kafka CDC capture pending payments if it's triggered only by database changes? If payments remain in a pending state without any status change, how will Kafka CDC detect them for Flink to process?

harinimurali
Автор

What happens if Flink cache fails? I think we will somehow have to redrive the CDC stream to repopulate the new cache instance?

abhishekmiet
Автор

I dont think you can do pre-materalize for the idempotency. If a user click the pay button twice, the second pay request will ask your "pre-materialize key service" for a new idempotent key. Now the problem goes back to the original one, how can you generate a idempotent key for the request in the first place.

shangma
Автор

How do you use cron job to search the doubly linked list in flink? Isn't the data store in memory in flink? In that case the cron job will be inside flink? Also why use flink instead of some in memory database like redis?

smithalan
Автор

Not sure if tinyurl/hash based approach is best suited for payment idempotent key, usually using order id or some combination of order id and uuid would suffice, simpler and more efficient, wdyt?

KeiraL-tb
Автор

Why do we need two Load Balancers? Couldn't we pass the request to the previous one?

raihanulalamhridoy
Автор

Reads do not necessarily have to interfere with writes.When payment status changes your db can have a CDC event that triggers an email, or stripe webhook can have a callback action that sends an email when payment processing is done.

rongrongmiao
Автор

The assertion behind the need for a derived Pending Transactions cache - that reads will hurt write throughput due to row locking - is not necessarily true if you're using a DB with MVCC (like Spanner or Cockroach). So I question the need for the separate cache.

htm
Автор

For payments DB, you have chosen
Spanner, Cockroach, Yugabyte.... Do these DBs provide strong consistency, and ACID and are they relational? quick question do we need relational DB here?

anshulkatare
Автор

I am wondering how you think the design would be different if it's like design a paypal (payments from account A to accountB), maybe also allowed for scheduled payment)?

Anonymous-ymst
Автор

thanks Jordan I have been watching your sd video each week have two qq regarding your design
1. could we use snowflake algorithm to generate id as idompotence key ?
2. was Flink processing part of payment service code ? if so, for fault tolerance case where payment service was down how is it going to affect flink processing ?

thanks

shuozhang
Автор

Thanks for the great video! Question about web hooks. So the Payment system is listening for web hook callbacks and the polling mechanism is only triggered when a pending payment hasn’t received a callback in a specified amount of time? Is that the idea?

NBetweenStations
Автор

Thanks for the video Jordan. How is polling going to work? Is there a cron job or a scheduler running every x minutes in the flink? Moreover maintaining the doubly linkedlist in the order of create time stamp would be log(n) right, as each event reaching flink could be out of order, right?

rationallearner