Get a better TTFB when calling a Docker Service
I am running a Web API application using DotNet core 1.1, running it inside a Docker container deployed on Kubernetes. I have the exact same API deployed on IIS (VM on Azure) (IIS VM and Kubernestes master and agent have the same specs and both connecting to the same DB server)
The request to the API deployed on IIS is fast as seen below in the image
The request to the API deployed on Kubernetes inside Docker is slow
here is my Dockerfile:
FROM microsoft/aspnetcore:1.1
ENV ASPNETCORE_ENVIRONMENT Docker
WORKDIR /app
EXPOSE 80
COPY . /app/
ENTRYPOINT ["dotnet", "X.X.X.API.dll"]
What could be causing this behavior? I have looked everywhere with no clear documentation related to DotNet core performance on Docker.
I think there can be at least 2 reasons for that:
Your Web API application depends on some DB/storage and for some reasons there bigger latency when you run it on k8s.
Probably you did not configure deployment limits/requests for CPU.