I recently moved from Lenovo x230 with Ubuntu 14.10 linux to Macbook Pro w OSX Yosemite
and after i configured everything the way it was, i am experiencing extremely poor performance in my Symfony 2 projects, page takes like 5-10 times longer to load.
As far as i can tell there is some I/O problem and PHP has really slow access to files compared to linux, even tho ssd hdd should be a ot faster then the on i had in my old lenovo.
Solution: Disable the FireVault feature in osx, it has very poor performance while working with thousands of small files.
Related
I'm not used to ask question on forum but this one is out of my scope.
Here is my discovery :
php performances are way different on depending of OS.
Here is the experiences :
I used a brand new Laravel projet from the official documentation (I guess you can do the same with Symfony or even any PHP projet)
I used a profiler Laravel debugbar (I guess you can use any profiler you want or even browser inspector)
I deployed the projet on Windows, MacOs and Linux virtual machine (linux VM is hosted by the same PC than the one for the test on Windows)
I tried with the same PHP configuration
I disabled windows defender
I tried with PHP NTS and TS on all machines
Here are the results :
The loading basic page of the dashboard takes around
200ms on Windows
20ms on MacOs
20ms on Linux Virtual machine
Basical Windows is 10 times slower than the others OS
This is related to the performance os the CPU since Linux VM is 10X times faster than Windows on the same machine
Here is my guess :
PHP build are different depending of the OS (of course) and the one for Windows is defensively not as performante as the others (sad story)
Windows use something on top of PHP that makes it slower.
Here are my questions :
What is causing that lack of performances on Windows ?
Is it possible to run PHP faster on Windows ?
Please give constructive answer :
Windows is bad is not an answer
Windows use services that slower PHP execution without giving any name of services nor program is not a constructive answer.
Giving more tests to do to get interring result is a constructive answer.
Thank you for your help
Maybe this answer can solve your problem. The different file system on Windows and Unix/Linux.
php window 4~5 times slower in windows than linux
I've been using Ubuntu dual booted with Win 10 for the past 2 years and I absolutely love ubuntu, however, due to my studies, I need frequently to use softwares like Excel, PowerBI, MiniTab, which only work on windows and have no good support through Wine unfortunately.
Currently I'm considering moving back to Windows, it's still good, but I don't want to waste a lot of time configuring PHP and JS for a project I'm working on on Ubuntu.
This project is based on Laravel 8, VueJS and MySQL for the database and I'm looking at the most efficient way to import this project to windows.
Using VirtualBox :
I thought about installing ubuntu as a VM on Windows and reinstall all dependencies on that VM and code directly from the VM, but I have around 8 gb od RAM and a cpu I5 4th gen, with only HDD drive. I don't know if I will be comfortable coding on the VM with these specs, especially I will be running chrome and PHP Storm at the same time on the VM which can get up to 5gb of ram alone back on ubuntu.So I won't have any left for windows.
Any other solution ? I thought about using Docker, I don't know if it's suitable in this case ? like importing the project into a docker container in ubuntu, then move back to Windows and use that docker container in php storm or another IDE ?
I also tried WSL with no success since my linux partition is not a physical one.
What's the best solution given my specs to keep working on this project without leaving windows and can be set up easily ?
I started to use Devilbox on Mac instead of Valet Plus. Devilbox is great but it is extremly slow. I found Performance issues on Docker for Mac in documentation, so I added MOUNT_OPTIONS=,cached to .env file. Result is better performance, but still too slow (30 seconds to load page in Symfony). Devilbox as such runs fast but projects with cache folder nope.
This is my current Docker setting (I enabled maximum of sources):
That might be related this answer which I've answered last week.
Docker in MacOs is very slow
Because of Mac OS Docker client doesn't equal real Docker performance on Linux.
OK, I tried docker-sync and I did not realize any speed up. I decided to install Valet plus as I need to have multiple PHP version (easily switchable), MailHog, Xdebug, SSL on local domains, DnsMasq etc. All of this comes out of the box in Valet plus. I thought it would be much better to develop in Docker but Symfony uses really a lot of cached files on disk so this was really unusable (as page load was between 30 to 60 seconds).
Recently i made a performance scenarios with hhvm and i found hhvm faster than php-fpm5.5 (with opcache) only if the testing website quite big (200+ includes) but perform terrible with small footprint application like Yii 1.1.16 testdrive contact page.
did i make some mistake or it is normal?
environment:
Machine: 64 GB / 20 CPUs digitalocean
PHP 5.5.9-1ubuntu4.7 OPcache v7.0.3
HipHop VM 3.6.1 (rel)
Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-46-generic x86_64)
cpu consumption serving small footprint webpages on hhvm
HHVM can be slower for /very/ lightweight pages; however, there's not enough information here to be sure if that's the case here:
are you sending warmup requests? If so, how many, and how? The JIT will be slower for the first few requests on almost any workload (same applies to other JITs, such as the JVM)
how are you actually measuring? Siege, ab, ?
I rent Windows 2008 64 R2 on a shared hosting environment with the following specs:
Intel XEON E5520 # 2.27GHZ
2 GB RAM
IIS 7.5
PHP v5.4
MySQL 5.5.27
FastCGI
Normally, I develop for .NET, and my websites are working great with fast rendering times.
However, I have a couple of Wordpress sites as well, and they are rather slow compared to the .NET websites. Today, I decided to investigate this. I just installed a fresh WordPress 3.8 copy using WPI (Web Platform Installer).
The website takes about 1.1 seconds to render (so it takes 1.1 seconds before any response is returned from my web server), which is, in my opinion, really slow.
I didn't install PHP/MySQL on the server myself, but I think that the best well known practices are in place, at least FastCGI is installed.
But still, I believe that Wordpress should be performing much better, even on a WIMP environment.
So, my questions are:
Should I expect more performance with this setup on the given environment (no additional optimizations such as caching), or is 1.1 seconds of rendering time normal?
And if so, any ideas on what's going on?
Btw, I know that I can speedup Wordpress somewhat by using plugins like W3TC.
Today, I finally was able to fix my slow loading problem; until now, my Wordpress sites where still loading slowly.
By chance, I stumbled upon this article:
http://www.customfitonline.com/news/2013/6/20/solve-wordpress-on-windows-server-problems/
I was like, let's try that "Slow Page Loading" tip, change localhost to 127.0.0.1 in wp_config.php:
define('DB_HOST', 'localhost');
To
define('DB_HOST', '127.0.0.1');
Sure enough, this setting makes a HUGE difference in page loading!