Memory Leak

Issue #23 resolved
Ben created an issue

The attached file shows a memory leak of around 1 MB for 1000 connections. The size of the post data and the size of the response appear to have no impact on the amount of memory leaked, so I've not included that in my test file. I'm not sure if the issue is my code or the event module. I've tried to follow all the instructions to make sure everything is properly closed/freed etc.

Using the attached file running on Ubuntu 14.04. Here is the PHP version:

php --version PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

php -n -dextension=event.so --ri event

Event support => enabled Sockets support => enabled Debug support => disabled Extra functionality support including HTTP, DNS, and RPC => enabled OpenSSL support => enabled Thread safety support => disabled Extension version => 1.11.3 libevent2 headers version => 2.0.21-stable

The attached file is configured to run on port 0.0.0.0:8082. I have run tests on the file with this command:

curl "http://localhost:8082/server-stats" memory(false)=0.2373 MB

ab -n100000 -c100 "http://localhost:8082/hi

curl "http://localhost:8082/server-stats" memory()=92.0629 MB

======================================================== I was shocked how fast this is. I've run tests with a small 2KB gif image and getting over 10,000 req/sec on a small vm and over 18,000 req/sec with echoing 'hello world'.

Thanks! Ben

Comments (2)

  1. Ben reporter

    Hey,

    Apparently I boneheaded something. I was running a few more load tests and found that the issue is fixed:
    Here are the stats: Requests: 429,000 memory=15.0882 MB

    It runs about 13,000 requests per second on my test server with 1,000 concurrent users with HTML, CSS, and HTML files.

    Thanks! Ben

  2. Ruslan Osmanov repo owner

    Should be fixed in both php5 and php7.

    No, there were leaks, indeed. There may be more, especially within the HTTP classes.

  3. Log in to comment