dotnet core web api running on built in Docker container and running on Kubernetes

12/7/2017

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

enter image description here

The request to the API deployed on Kubernetes inside Docker is slow

enter image description here

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.

-- Johnny Zghaib
.net-core
docker
iis
kubernetes
performance

1 Answer

1/17/2018

I think there can be at least 2 reasons for that:

  1. Your Web API application depends on some DB/storage and for some reasons there bigger latency when you run it on k8s.

  2. Probably you did not configure deployment limits/requests for CPU.

-- Alik Khilazhev
Source: StackOverflow