dongying6179 2016-08-17 05:21
浏览 75

php窗口比linux慢4~5倍

I have a site deployed to both Windows server 2012 and ubuntu 14.04 and there is a significant performance difference. The code base and DB data is exactly the same.

Windows environment

  1. Windows Server 2012 in AWS EC2 t2.medium (dual core 4GB ram)
  2. PHP 5.5 64 bit ts
  3. Apache 2.4.23

Linux

  1. Ubuntu 14.04 in AWS EC2 t2.medium (dual core 4GB ram)
  2. PHP 5.5 64 bit ts
  3. Apache 2.4

Both site have OpCache enabled.

The execution time (sole PHP execution time, excluding all network traffic)

  • Windows: 2.6-2.8s
  • Linux: 200-400ms

In windows, what we notice is there is a almost 100% CPU load peak and a 3-4MB IO read peak on single page load.

I have already came across various post in Stackoverflow regarding php performance in windows but we have already applied/tested suggestion from those post to no avil

Any advice would be appreciated!

  • 写回答

1条回答 默认 最新

  • doufei5537 2016-08-17 09:59
    关注

    Finally got myself an answer to this

    The performance difference is due to php function is_dir() perform terrible in Window

    Test1: run simple script to loop 1000 times to invoke is_dir()

    • Windows: 217ms
    • Mac: 8ms

    Test2: profile the code with xdebug and is_dir() sit at top of the list for highest execution time

    Some other reference also point out the same issue https://github.com/facebook/hhvm/issues/4431

    Hope this post can help others facing the same problem

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题