php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50333 [PATCH] - Improving multi-threaded scalability by using emalloc/efree/estrdup
Submitted: 2009-11-30 12:45 UTC Modified: 2013-11-05 18:32 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: yoarvi at gmail dot com Assigned: ab (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 6SVN-2009-11-30 (SVN) OS: Solaris 5.10 (SPARC)
Private report: No CVE-ID: None
 [2009-11-30 12:45 UTC] yoarvi at gmail dot com
Description:
------------
Using malloc/free in a multi-threaded process limits its scalability
because of the process-wide lock inside malloc/free. The scalability
of the PHP engine in a multi-threaded process can be improved by
reducing the use of malloc/free/strdup  and instead using
emalloc/efree/estrdup wherever possible (at least in the main request
processing code paths).

The code paths in TSRM/tsrm_virtual_cwd.c are invoked quite frequently
and they use malloc/free/strdup. I'd like to submit the following
patches (based on the PHP6 source tree) for review that incorporate
the use of emalloc/efree/estrdup in the virtual_cwd code paths. In
order to use emalloc/efree I had to relocate tsrm_virtual_cwd.c from
the TSRM directory to the Zend directory. I've split the change into 3
patches in order to make the changes easy to see

Avoid name clash between global and local variable
(http://bugs.php.net/bug.php?id=50101)
http://bitbucket.org/arvi/arviq/src/tip/arvi-08-namespace

Rename TSRM/tsrm_virtual_cwd.[ch] to Zend/zend_virtual_cwd.[ch]
http://bitbucket.org/arvi/arviq/src/tip/arvi-08-virtual_cwd

Replace malloc/free/strdup with emalloc/efree/estrdup
http://bitbucket.org/arvi/arviq/src/tip/arvi-08-virtual_cwd-emalloc


[http://marc.info/?l=php-internals&m=125846494007872&w=2]


Expected result:
----------------
Improved scalability on multi-threaded/multi-core systems.


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 10:14 UTC] jani@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2013-10-14 10:03 UTC] ab@php.net
-Assigned To: +Assigned To: ab
 [2013-10-14 13:51 UTC] pajoye@php.net
@a will review/update the patch.

We will then run all required tests before applying it to master (discussed with Dmitry too).
 [2013-11-05 18:32 UTC] ab@php.net
-Status: Assigned +Status: Closed
 [2013-11-05 18:32 UTC] ab@php.net
the pull request merged
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC