Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

By aleeekoi
I created a web service resource on App Platform, it’s built from a custom Dockerfile. The App works well (most of the time) but sometimes (randomly), requesting same API endpoint hangs and take a lot of time to complete. The same docker container doesn’t have this issue running locally, I think this problem i related with the App platform Load Balancer and some nginx configuration. Are there any particular configuration to made if work? Thanks
These are my configs:
/etc/nginx/nginx.conf:
# user www-data;
pid /tmp/nginx.pid;
worker_processes 1;
events {
worker_connections 1024;
}
http {
charset utf-8;
# copies data between one FD and other from within the kernel
# faster than read() + write()
sendfile on;
# send headers in one piece, it is better than sending them one by one
tcp_nopush on;
# don't buffer data sent, good for small data bursts in real time
tcp_nodelay on;
# allow the server to close connection on non responding client, this will free up memory
reset_timedout_connection on;
# hide server info for security
server_tokens off;
log_not_found off;
types_hash_max_size 2048;
client_body_buffer_size 16K;
client_header_buffer_size 4k;
client_max_body_size 20M;
large_client_header_buffers 4 16k;
client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;
# cache information about FDs, frequently accessed files
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
# MIME
include mime.types;
default_type application/octet-stream;
# enhancment
# Replace loadbalancer IP(real-ip) with actual client IP.
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
# load configs
include /etc/nginx/conf.d/*.conf;
}
/etc/nginx/conf.d/app.conf:
server {
listen 8080;
server_name app;
root /var/www/html/public;
autoindex on;
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
# nginx status page
location /status-nginx {
stub_status on;
access_log off;
}
# fpm status page and ping page
location ~ ^/(status|ping)$ {
access_log off;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
/usr/local/etc/php-fpm.d/www.conf:
[www]
user = www-data
group = www-data
listen = /var/run/php-fpm.sock
listen.owner = www-data
listen.group = www-data
pm = ondemand
pm.max_children = 9
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.process_idle_timeout = 60s
pm.max_requests = 5
request_terminate_timeout = 60s
request_slowlog_timeout = 30s
ping.path = /ping
pm.status_path = /status
slowlog = /proc/self/fd/2
catch_workers_output = yes
1a3ca91ed97c49039b3e74fb7229fa
6efbf601fa8e49c884398e706c4672
f27857d3fd85405b8f50d9997c684d
petercorrea
ulope
josaf bodia
jediD83
rafaelri
Lucas Souza
Ben Buzbee
andreasAngler