How do I fix an unusual latency in my initial request to my web api reddit / selfhosted ---------------------------------------------------------------------- Top_Chocolate_4203 · 2023-09-28 01:50 Hello world! I am very new to this selfhosting world and networking, but as the title reads I am facing an issue where the initial request to my api is always much slower then the subsequent request. In other words, my initial request will take 400-1200ms but the same/different request right after would take around 30-70ms. I have a desktop running a virtual machine in bridge network which runs kubernetes cluster that has my rest api running in pods. I am exposing my rest api to the public by creating a service for it with NodePort and using nginx reverse proxy to map the domain (In AWS Route53) to the Kubernetes Cluster IP and nodeport. Do you guys have any idea on why this is happening? And how to fix? ---------------------------------------------------------------------- vermyx · 2023-09-28 04:38 This is the correct behavior. When you start up your web server this doesn't start your web site. The first request starts your website and at that point your background processes and what not are started. Your next request doesn't have to wait for this to start because it is started.