43

Powered by .NET Core 进展:验证高并发性能问题嫌疑犯 docker swarm团队

 4 years ago
source link: https://www.cnblogs.com/cmt/p/11335456.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Powered by .NET Core 进展:验证高并发性能问题嫌疑犯 docker swarm

相关博文:

抱歉,.NET Core 版博客系统(博客后台除外)的发布给大家带来麻烦了,我们正在一边忙着修各种 bug ,一边排查访问高峰高并发性能问题。

对于发布后遇到的高并发性能问题,我们一点都没去怀疑 .net core ,我们怀疑的是 docker swarm ,怀疑在高并发下 docker swarm 网络性能急剧下降,而且极不稳定。

对比新旧版博客系统所消耗的服务器资源,差距之大让人乍舌。同样的并发,之前基于 .net framework 的旧版博客系统用 6台4核8G 的阿里云 windows 服务器就能撑住,而现在基于 docker swarm +  .net core 的新版博客系统用 6台8核16G 的阿里云 centos 服务器都撑不住。

为了验证我们对罪魁祸首 docker swarm 的怀疑,我们今天已经将 .net core 版博客系统改用 docker-compose 部署:

version: '3.7'
services:
  web:
    image: blog-web
    restart: always
    deploy:
      replicas: 1
      resources:
        limits:
          cpus: '4'
          memory: 7G
        reservations:
          memory: 500M
    ports:
      - 80:80
    working_dir: /app
    environment: 
      - TZ=Asia/Shanghai
      - COMPlus_GCHeapHardLimit=1C0000000    
    command: bash -c 'sh run.sh'
docker-compose --compatibility up -d 

现在已经发布上线,如果真的是 docker swarm 的问题,明天上午的访问高峰将验证出结果。

目前用了3台4核8G的服务器,明天根据负载情况再增加服务器。

8:40 左右,响应速度变慢,加了1台服务器,响应速度立马恢复。(之前使用 .net framework + windows 也是在这个时间点加服务器)

9:00 左右,又加了1台服务器,现在是5台4核8G的服务器。

9:35 左右,又加了1台服务器,现在是6台4核8G的服务器。

10:00 左右,又加了1台服务器,现在是7台4核8G的服务器。

13:10 左右,退回到 .net framework + windows 博客系统,.net core 博客系统待调整部署与修复 bug 后再上线。

上午使用 docker-compose 部署时,博客系统所依赖的后端服务部署在另外一个 docker swarm 集群上,结果这个集群的路由转发出现了问题。使用 docker-compose 部署还需要将博客系统所依赖的服务进行 docker-compose 部署。

从上午的访问高峰的情况看,docker-compose 部署时的资源瓶颈在 CPU ,出现响应速度慢时加服务器就能解决(这是正常情况),没有出现使用 docker swarm 部署时那种响应速度极不稳定、加服务器也无补的情况。

docker-compose 部署是否能够在访问高峰长时间持续稳定运行以及需要多少台服务器?待进一步验证。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK