Bug #70984 [Opn->Ana]: Script extreme slow compared to 5.6, MAP_HUGETLB problem?

From: Date: Fri, 27 Nov 2015 21:40:02 +0000
Subject: Bug #70984 [Opn->Ana]: Script extreme slow compared to 5.6, MAP_HUGETLB problem?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197471@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70984&edit=1

 ID:                 70984
 Updated by:         rasmus@php.net
 Reported by:        arjen at react dot com
 Summary:            Script extreme slow compared to 5.6, MAP_HUGETLB
                     problem?
-Status:             Open
+Status:             Analyzed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Linux
 PHP Version:        7.0.0RC8
 Block user comment: N
 Private report:     N

 New Comment:

Just to verify that it is due to the lack of huge pages, can you configure some and re-run your
test. Something like:

    sysctl -w vm.nr_hugepages=256


Previous Comments:
------------------------------------------------------------------------
[2015-11-27 12:54:26] arjen at react dot com

Description:
------------
Testcase runs in 6.7 sec.
1.7 sec in PHP 5.6.

strace reports lots of ENOMEM (Cannot allocate memory) warnings:

munmap(0x7fd131400000, 2097152)         = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB, -1, 0) = -1 ENOMEM
(Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd131400000
madvise(0x7fd131400000, 2097152, MADV_HUGEPAGE) = 0
munmap(0x7fd131400000, 2097152)         = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB, -1, 0) = -1 ENOMEM
(Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd131400000
madvise(0x7fd131400000, 2097152, MADV_HUGEPAGE) = 0
[....]

Ultimately the memory allocation succeeds. With bigger javascript inputs (it's a javascript
minifier), running time can be in 10-60 minutes, compared to 1-5 minutes under 5.6.

The PHP binary is compiled on a host with HUGETLB support, however the target host
(systemd-container) has not Hugepages (configured). 5.6 testing was done with same memory amount.
There is enough (normal) free memory.

cat /proc/meminfo
[..]
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0



Test script:
---------------
https://gist.github.com/arjenschol/49a847c07154b51130b2

Expected result:
----------------
Execution at least as fast as 5.6.

Actual result:
--------------
3-4x slower compared to 5.6.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70984&edit=1


Thread (16 messages)

« previous php.bugs (#197471) next »