Hhvm: 3.14 using twice as much memory to boot compared to 3.13.2

Created on 23 Jun 2016  路  9Comments  路  Source: facebook/hhvm

HHVM Version

HHVM-3.14.1-0-gd99b370804b7e0234ab794869d1ba1774c848e85

Standalone code, or other way to reproduce the problem

Just starting hhvm is enough to see the problem. Tested both versions on Ubuntu 14.04 (trusty). Tested 3.14.1 also on Ubuntu 16.04 (xenial), same behaviour.

$ cat /etc/hhvm/server.ini 
; php options

pid = /var/run/hhvm/pid

; hhvm specific 

hhvm.server.port = 8000
hhvm.server.type = proxygen 
hhvm.server.default_document = index.php
hhvm.server.error_document404 = index.php
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
hhvm.server.source_root=/var/www/public

; default log location is stdout/err, which is good for docker
hhvm.log.use_log_file = true

Running with:

$ hhvm -m server -c /etc/hhvm/server.ini

Expected result

Previous versions (tested on 3.9, 3.12.2, 3.13.2) consume around 90M to boot. 3.9 running wordpress for some months consumes around 170M.

Actual result

3.14.1 is consuming around 300-340M just to boot.

Other information

dmesg | grep -i numa
[    0.000000] No NUMA configuration found

The defaults for hhvm.jit_a_*_size don't seem to have changed.

memory leak mid-pri webserver

Most helpful comment

Confirmed. Just pushed it to the 3.15 branch, whenever we cut next we'll pick it up.

All 9 comments

Same issue in 3.15
No proxygen here.

I can repro this. It seems to be caused by c2314526 - "Make jit::ProfData thread-safe". I'm seeing about 96MB before and 256MB after.

In c2314526e1424c95e028755e3ccb8e84507627f8 @swtaarrs made a bunch of data structures atomic, and in the process also gave them default allocation sizes which were probably not very appropriate for small sites.

These sizes became configurable in cb4a7e5bbbb83cd624b65146f4aa4b72b7077cda (which doesn't look like it's in 3.14 or 3.15 unfortunately). If you're running master I suggest adjusting hhvm.func_count_hint and hhvm.pgo_func_count_hint. We can probably merge cb4a7e5bbbb83cd624b65146f4aa4b72b7077cda into 3.15.1, I'm not sure if it will pick cleanly into the 3.14 branch. If you're building yourself you can also adjust kFuncCountHint in hphp/util/atomic-vector.h and rebuild.

Closing since this is intended behavior.

The default sizes I set in cb4a7e5bbbb83cd624b65146f4aa4b72b7077cda are minuscule compared to the old value of kFuncCountHint, so I wouldn't expect people to have to lower them any further (once they have that diff).

@paulbiss If we want to do something for 3.14, we could dramatically lower kFuncCountHint without any of my other changes.

Officially we aren't supporting 3.14 anymore, but I'll monitor this and if there's sufficient interest it would be an easy change to roll.

can you please confirm 3.15.1 will have cb4a7e5 applied?

Confirmed. Just pushed it to the 3.15 branch, whenever we cut next we'll pick it up.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fredemmott picture fredemmott  路  3Comments

acrylic-origami picture acrylic-origami  路  4Comments

Sakretsos picture Sakretsos  路  7Comments

octmoraru picture octmoraru  路  5Comments

jacobconley picture jacobconley  路  4Comments