所以,我一直在我的 docker 容器(nginx 连接到 php-fpm)上运行一些基准测试,它比裸机慢 70 倍以上。与每秒 7,000 个裸机相比,我每秒可以管理 100 个请求。
docker-compose.yml:
version: '3'
services:
#web
frontend:
build:
context: ./environment/nginx
dockerfile: ./Dockerfile
container_name: nginx_software
restart: always
ports:
- 80:80
volumes:
- ./environment/nginx/nginx.conf:/etc/nginx/nginx.conf
links:
- php
php:
build:
context: ./environment/php
args:
version: 7.3-fpm
dockerfile: ./Dockerfile
container_name: php_software
restart: always
ports:
- 9000:9000
volumes:
- ./api:/var/www/software:cached
links:
- mysql
mysql:
build:
context: ./environment/mysql
args:
version: 5.7
dockerfile: ./Dockerfile
container_name: mysql_software
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- 3306:3306
volumes:
- ./environment/mysql/data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: …Run Code Online (Sandbox Code Playgroud)