Why hhvm performance is terrible on small webapp? - php

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, ?

Related

PHP Laravel memory usage increase on Direct Admin server

We have developed Laravel based software, locally tested with Laravel Valet and everything is working fine. One installing on a staging (direct admin) webserver with exactly the same database and code the memory usage dramatically increased.
Local testing specs:
OS: MacOS Catalina
Proc: 2.3 GHz 8-Core Intel Core i9
Memory: 16 GB 2667 MHz DDR4
Staging server specs:
OS: CentOS 7.0 64-Bit
Processor Speed (MHz) 2693.670
Total Memory 1014728 kB
This is a basic static page:
Staging server: 21MB, PHP 7.4.2
Development machine: 5MB, PHP 7.4.4
Another larger page (which needs optimization):
Staging server: 101MB, PHP 7.4.2
Development machine: 85MB, PHP 7.4.4
We know this development machine is a lot slower but we cannot explain the memory usage increase. Does anybody know how to analyze and resolve this?
The used framework is Laravel v6.18.20
Well Laravel Valet uses a very lightweight web server and that is a huge difference, I suggest to configure your webserver to use Nginx instead of Apache and be sure you are using PHP as FPM module, generally speaking, servers with Direct Admin uses Apache webserver by default and that will increase the memory usage of every request.
Try to switch to an Nginx webserver

Devlibox (Docker) extremly slow on Mac

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).

php window 4~5 times slower in windows than linux

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
Windows Server 2012 in AWS EC2 t2.medium (dual core 4GB ram)
PHP 5.5 64 bit ts
Apache 2.4.23
Linux
Ubuntu 14.04 in AWS EC2 t2.medium (dual core 4GB ram)
PHP 5.5 64 bit ts
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
PHP factor 30 performance difference from Linux to Windows
Windows 7 php + Symfony2 terribly slow
Any advice would be appreciated!
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

Symfony 2 projects extremely slow under osx yosemite

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.

How to improve performance of my Joomla based Intranet system?

I have a Joomla 1.5.10 based Intranet system. In this application, we have more than 80% custom extensions. Below is the configuration:
Apache version : Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/0.9.8
PHP version : 5.3.13
MySQL version : mysqlnd 5.1.11
It has 3 dedicated Appliocation Server which configuration is :
Windows Server 2008 Standard Edition Service Pack 2
Compiler: MSVC9 (Visual C++ 2008)
Architecture: x86
Again, it has dedicated DB server which configuration is :
8x Intel(R) Xeon(R) CPU X5460 #3.16GHz, 8.0GB RAM, Windows Server 2008 Standard Edition Service Pack 2.
Below is the MySQL settings in my system:
Sl.# Parameter Value
1 Key Buffer 547M
2 Sort Buffer Size 256K
3 Query cache limit 4M
4 Cache size 350M
5 Long query time 5
6 Interactive timeout 300
7 Max Connection 800
8 Thread cache size 36
We have configured WAMPSERVER (32 BITS & PHP 5.3) 2.2E on our servers and then install MySQL5.1 on other dedicated server. Hence, we are not using MySQL provided with WAMP.
My system become too slow or crash when number of DB connection threads crossed 100. Number of logged-in users we can see are 3000-5000 only. Multiple queries start logging in the slow query logs and huge number of queries are in sleep state. Those queries which are running normal also start logging in slow query log and taking much time in execution.
I am unable to find the bottlenecks in my system. Is there Joomla or MySQL creating bottlenecks. Would upgrade helpful to avoid the bottlenecks and increased the performance of our system? If yes, what should we upgrade - Joomla or MySQL and what will be the strategy to upgrade the system. Is there a known performance/scalability issue in 1.5.10 that is resolved by an upgrade?
My overall goal is to increase the system performance.
Thanks in advance.
First of all as mentioned in my comments, upgrading your CMS to atleast Joomla 1.5.26 will help. You're running PHP 5.3 and only Joomla 1.5.15+ is fully compatible with this PHP version. Seeing as you're using 1.5.10, there will be some issues there.
Apache is not an issue here. There are sites out there running Joomla that have thousands of users and run Aache without any problems, so not to worry about this.
From Joomla 1.6 onwards, the optimization started. Reduced and sorted database tables, endless bug fixes and also security issues. The framework has also improved majorly not to mention it supports PDO, mysqli (more secure than mysql) and postgre. Ugrading to Joomla 3.2 (latest version) will be of course a massive step. You will have to make all your custom extensions compatible with the new Joomla version and keep up to date with the latest coding standards. Even though this is a big step and will of course take some time, it's fully worth it. Joomla 1.5 hasn't been supported for a long time now and things are moving forward majorly.
Your server specs are good, you're running a decent PHP and Apache version, you're MySQL version could be upgraded however it's still not bad. So overall, it's not a server related issue.
I do think that it could very well be the way your custom extensions have been coded. So my final suggest would simply be taking a backup of your site and start migrating it and all of your extensions to Joomla 3.2.
You can change the webserver. Apache is totally bloat. Lighttpd can help to fix the problem. It' also simpler to run. A cms upgrade most likely break something.

Categories