CodexBloom - Programming Q&A Platform

Apache 2.4.54 - Slow Response Times When Using ProxyPass with Backend Node.js Service

👀 Views: 55 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-14
apache proxy performance Apache

I'm converting an old project and I'm converting an old project and I'm wondering if anyone has experience with Quick question that's been bugging me - I'm experiencing significantly slow response times when using Apache 2.4.54 as a reverse proxy to a Node.js backend service. I have a simple configuration where requests to a specific path are proxied to the Node.js application running on port 3000. However, under load, the response time can take upwards of 5 seconds, which is unacceptable for our application. I've enabled logging on both Apache and the Node.js application, and the logs show that the application itself is responding quickly, around 100ms. Here's a snippet of my Apache configuration related to the proxy: ```apache <VirtualHost *:80> ServerName example.com ProxyPreserveHost On ProxyPass /api http://localhost:3000/api ProxyPassReverse /api http://localhost:3000/api LogLevel debug ErrorLog ${APACHE_LOG_DIR}/behavior.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ``` I've tried increasing the `ProxyTimeout` directive to 60 seconds, but that didn't help the response times. I also checked the `KeepAlive` settings, but those seemed appropriate as well (with `KeepAlive On` and `MaxKeepAliveRequests 100`). It seems like the bottleneck is somewhere in the way Apache handles the requests. I also verified that my server has sufficient resources (CPU and Memory). Could this be an scenario with the way Apache is managing connection pools for the proxy? Is there a way to optimize this configuration to improve performance? Any insights would be greatly appreciated! My development environment is Ubuntu. What am I doing wrong? Any feedback is welcome! This is for a web app running on Debian. I'm working on a application that needs to handle this.