Ruby on Rails/Puma API in docker container is slow in Fedora 40

I’m using docker to run some containers in the development environment, the projects are node js/express API, React/Ngnx client, Mongodb, Postgres DB, and Ruby on Rails API.
All the containers run properly and in time except for the Ruby on Rails.

This container takes a long time to process the request I mean when I make a request using curl the request comes quickly to rails just like the logs suggest but takes a long time for the logs of the controller to be printed.

I requested out of the container and in the container and the result is the same, it takes a long time to process the simple request.
I tested the connection between the RoR app and the Postgres and Mongo databases, and they responded quickly.

The interesting thing is if I run all the projects in Arch Linux, Ubuntu, and MacOS the RoR app responds quickly.

Probably a fedora stuff that I need to set up or an extra thing that I need to do after installing docker.

Fedora uses Podman as default. You might check if this gives a boost to your work speed.

2 Likes

Check if the issue persists when using a text TTY or accessing the host over SSH from another machine to isolate possible issues with video drivers, DE and GUI apps.

Check system monitor for abnormal resource utilization and possible bottlenecks related to CPU, GPU, RAM, disk I/O and network.

Check system logs for filesystem errors, SELinux alerts, resolver denials and timeouts, etc.

I don’t think is podman I’m installing docker, following the official documentation, basically I added the docker repos and then I ran sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Any case I confirmed that podman is not in my system I ran dnf list installes | grep podman and trows nothing

dnf list \*podman*

You have to install it … it is without daemons. While docker uses them.

1 Like

All good with that, I can access it fine with ssh and the system, the monitor system doesn’t show something anormal or weird actually docker stats look fine as well. I mean the docker container spends 1% - 3% of sources

I already installed it. It’s good to know about podman, this not solve the issue tho

1 Like

I read all this thing, and I isolated the system just like you mentioned and the docker is still slow.

Update 1: Another thing that I tried is to make permissive the SELinux and the docker is still slow.

Update 2: I’ve installed docker-desktop to have better graphs, the result is the same docker resources are good and it doesn’t waste a critical CPU or ram

Update 3: I’ve rebuilt all again but the result is the same.

Update 4: Now I’m checking the problem since another perspective is What if the issue is Ruby on Rails and not docker, Issues could happen since firewall issues, SELinux I tested those but the delay stay there.
I figured out that the code is processed but takes a long time and the client(the browser or curl returns 504 time out, I think this is Puma )

So now I changed the title of the post of Ruby on Rails/ Puma in docker container …

Update 5 The curl requests are slow inside the Ruby on Rails container

Check inside the container:

time getent hosts example.org
time nslookup example.org
time nslookup example.org 8.8.8.8
time nslookup example.org 2001:4860:4860::8888
time curl -v -o /dev/null https://example.org/
time curl -4 -v -o /dev/null https://example.org/
time curl -6 -v -o /dev/null https://example.org/

all that looks great.

But I got something interesting

Update 6
If my computer is not connected to the internet the RoR API response in time, so I’m looking for DNS issues or something like that.

Update 7
I’ve changed the DNS using the kde GUI

then I reload the computer but RoR still slow, nevertheless I’m still having the eye in some network issue, because the RoR works fine without internet conection

Update 8
I’ve tested changing directly the /etc/resolv.conf file I commented all and then I wrote

nameserver 8.8.8.8
nameserver 8.8.4.4

Then I saved the file and I tested it. The connection improved well but it was still not enough. I think this is good progress but I don’t know

  • Why did happen this?
  • What DNS is the property for me and my projects?
  • Why doesn’t the setup in the KDE GUI work?

Update 9
I applied the changes mentioned here

to disallow the dns=none that makes systemd doesn’t generate the /etc/resolv.conf now I can modify it manually and I putted the google dns but my RoR app is still slow.

Note that nss-dns is a fallback option since Fedora is configured with nss-resolve by default, while raising the priority of nss-myhostname can solve performance issues in some cases.

I made this change but it doesn’t work