Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96171 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43313 invoked from network); 27 Sep 2016 10:05:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2016 10:05:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.172 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.172 mail-yw0-f172.google.com Received: from [209.85.161.172] ([209.85.161.172:34431] helo=mail-yw0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/4A-04248-6544AE75 for ; Tue, 27 Sep 2016 06:05:11 -0400 Received: by mail-yw0-f172.google.com with SMTP id g192so5051856ywh.1 for ; Tue, 27 Sep 2016 03:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yBCxFjquayGtBlARnwgt87W3iPdLLSc1OE0oXFpUd7M=; b=o/KInn+rtns0F4h8x1BDIKagjnoc9tSijTBHhmxUOlIrrN7eOEQndD6iCB+hzmn0Xj 9TwVaM5wpvoBAlQkqrlSeQ2WTX94XEw19brlwlnAKudE9CqdG9t8zaEgxDoXyDEQOVxK 6hj7kz0T2ZTmxmpoItvIgMLXBFrFfd4ADgeuDD8aIftTig4ClB9DYs4steEvCJHXhGbb zGe+Bi2dPrZ+0wPxu0IYuZ+l89p2Wk37WlSCCbK0MAVhLizpGbK0sT2qs5BTiEYlgn1B bEQ5iGCdKqQoRwBdaeDdKYTc7fKDkdFEcCOV79PfRhviu/TlN4q2+cHIp/rLP0lc2N9O RQAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yBCxFjquayGtBlARnwgt87W3iPdLLSc1OE0oXFpUd7M=; b=OjdCtIxZQFfTWCYa+4RqPjvatknIV5nTWgjV68yNhInqEv1Gho56cHx6DuYvWiigO0 ccqQwORMOCtr6RFTmi5VNbR3JGsNZJMhD5TIyJeBqFzQ7Q8YMyoIntXgO3TyLCnqTzBt J1V3x0AKVvkgmdmU3asXR1FCOzcAk4OALWq3nCxVCHJW3MfrBIIegc95WcmTGGLvIFpL VIP9FVq7wEC9hm/vJQqZI/2OVqz3rD+ukCsf7ryKOvyTTXwga+17ksaGk9/w9a3kAmOr vRo54uWU7G/hNCDWCm7ywAlWomcL4KmHJGv0N+SpZoYMBABAFIIfeNz2siMFslqYW5aE OUgA== X-Gm-Message-State: AE9vXwNiLcEjUu4qM8LEv+AJRmy54w0jgfXEtzhznCuGH25fEr7rKrIN9ur1UkT7IWLCaug9pzN/QN2SrIM7IQ== X-Received: by 10.129.153.71 with SMTP id q68mr19635435ywg.4.1474970707919; Tue, 27 Sep 2016 03:05:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.215.150 with HTTP; Tue, 27 Sep 2016 03:05:07 -0700 (PDT) In-Reply-To: <0b9df431-c402-e38e-d19c-73799f621524@netwake.de> References: <0b9df431-c402-e38e-d19c-73799f621524@netwake.de> Date: Tue, 27 Sep 2016 12:05:07 +0200 Message-ID: To: Thomas Lamy Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c0bcc20198a73053d7a6159 Subject: Re: [PHP-DEV] How to get zval map to identify cpu hog? From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c0bcc20198a73053d7a6159 Content-Type: text/plain; charset=UTF-8 On Tue, Sep 27, 2016 at 9:08 AM, Thomas Lamy wrote: > 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 Before trying anything more sophisticated, I'd suggest to use "perf record" to check whether the GC is indeed the culprit. If it is, you'll see functions like "gc_mark_grey" etc taking the majority of the time. Nikita --94eb2c0bcc20198a73053d7a6159--