List the key functional requirements for the system (Ask the AI for hints if stuck)...
List the key non-functional requirements (performance, scalability, reliability, etc.)...
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
Define the data model. Identify the main entities, their attributes, and relationships. Consider the choice of database type (SQL vs NoSQL) and justify your decision based on access patterns...
yüksek sayıda trafikten bahsettiğimiz için müşteri ilk geldiğinde load balancera oradan da gateway tarafına geçecek ve gatewayden de apimizin olduğu sunucuya gelecek. burada yatay ölçeklendirme yapacağımız için şimdilik 1 gw ve 2 sunucu ile başlayabiliriz. Sonrasında müşteri bize post isteğiyle short yapmak istediği url'i iletecek biz de veritabanındaki tablomuzda (tablomuz id, key, value ve isRedisAdded kolonlarını iletecek). Burada key olarak müşteriye özel hazırladığımız bir short url olacak, value ise müşterinin bize ilettiği url olacak. Aynı zamanda asenkron bir şekilde bir job çalışacak, bu job isRedisAdded:0 olanları select yapıp redise basacak yine key short url, value ise client'ın ilettiği olacak.
Herhangi bir müşteri short url ile geldiğinde de ilk olarak redis'e bakılacak key var mı diye, yoksa db'ye bakılacak orada da yoksa 400 dönecek. Eğer bulunursa zaten value'daki linke redirect olacak.