Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96169 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29258 invoked from network); 27 Sep 2016 07:08:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2016 07:08:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=thomas.lamy@netwake.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=thomas.lamy@netwake.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain netwake.de from 78.47.58.218 cause and error) X-PHP-List-Original-Sender: thomas.lamy@netwake.de X-Host-Fingerprint: 78.47.58.218 srv.netwake.de Received: from [78.47.58.218] ([78.47.58.218:56556] helo=srv.netwake.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DE/F7-04248-9EA1AE75 for ; Tue, 27 Sep 2016 03:08:26 -0400 Received: from localhost (localhost [127.0.0.1]) by srv.netwake.de (Postfix) with ESMTP id DAA8E1522C6 for ; Tue, 27 Sep 2016 09:08:22 +0200 (CEST) Received: from srv.netwake.de ([127.0.0.1]) by localhost (srv.netwake.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QSs0YpFYfKwA for ; Tue, 27 Sep 2016 09:08:14 +0200 (CEST) Received: from PHPTLamy.local (unknown [213.61.99.98]) (Authenticated sender: thomas.lamy@netwake.de) by srv.netwake.de (Postfix) with ESMTPSA id 5102015205E for ; Tue, 27 Sep 2016 09:08:12 +0200 (CEST) To: PHP internals Message-ID: <0b9df431-c402-e38e-d19c-73799f621524@netwake.de> Date: Tue, 27 Sep 2016 09:08:13 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: How to get zval map to identify cpu hog? From: thomas.lamy@netwake.de (Thomas Lamy) Hi, it's the second time I'm running into this: In a rather big project I'm using gearman to enable semi-parallel processing of many small jobs. I'm using PHP 5.6.22-0+deb8u1 with OPcache 7.0.6-dev on Debian. All was well before the code needed refactoring for a new feature: 30 workers processed 4000 jobs/second at around 5% CPU usage. After refactoring (no functional changes), some times after starting the workers, processing is getting slower and slower. After about 2 hours I hit 100% CPU usage, at about 300 jobs/second. Memory usage only doubles from start to stall, which is what I observed before when everything was fine. I suspect this to be a problem of the cycle collector, or with garbage collecting in general. So at any given time, I want PHP to dump all the zval's around, which I have to evaluate manually to find "problematic" ones. This could be triggered by either a function call, or by adding/extending PHP's signal handler and sending that signal to the interpreter process. Where do I have to look at in the sources? Or is there already a tool which does what I want, but didn't find yet? I also learned this _could_ be hash collisions related to reordering and renaming the data in my code, but as I'm currently stuck with 5.6 I can't use the HashDoS related patches floating around here. Any hints on where to find the culprit? Thanks, Thomas