Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82039 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29378 invoked from network); 6 Feb 2015 11:07:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2015 11:07:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.53 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.192.53 mail-qg0-f53.google.com Received: from [209.85.192.53] ([209.85.192.53:48731] helo=mail-qg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/50-45146-A60A4D45 for ; Fri, 06 Feb 2015 06:07:22 -0500 Received: by mail-qg0-f53.google.com with SMTP id f51so10557948qge.12 for ; Fri, 06 Feb 2015 03:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=EdJWW0ilYoLTAGymBW4zOA906m1mEW3hRKpzdn8ixbw=; b=UgNC5YkVmAJovPPqKjTlReQNccZjjAXB48Vl0iOcB4e7FlCI0/W9vIN1yQjJfclNCC 2S4psEym7ZRgquHqsFy252KZUsW6tTROEJ8x/wuGISyLSOwPezKaBnl+bAsuKfH7vXPk HhA5aD1YKAsd449WGbvN8IiNZvwLNRBzIbeusynA3ZtrV/1PZwNU77y/GRKoefXB4nQy qRrxzT+lW1phK4Wf0FHZR9WUGnoe4bGz8W/7leuZnhZxkMSO+U4h8zRkxiA03PVZ1mBf qUtWMUNvev3Q4caOKAsGtvm+fr+aiRVBRc3kzUmxhunM4gtITVOBDH9wX0jm0F4YPJfk yrAw== X-Received: by 10.224.161.138 with SMTP id r10mr6863113qax.21.1423220840117; Fri, 06 Feb 2015 03:07:20 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.28.72 with HTTP; Fri, 6 Feb 2015 03:06:39 -0800 (PST) In-Reply-To: References: <54D3EE95.2080109@lerdorf.com> Date: Fri, 6 Feb 2015 20:06:39 +0900 X-Google-Sender-Auth: ys0yDIFIVlY6lNb6iJD0jFJ68TM Message-ID: To: Xinchen Hui Cc: Rasmus Lerdorf , PHP internals Content-Type: multipart/alternative; boundary=089e014953ec9cbbd2050e696cf7 Subject: Re: [PHP-DEV] Annotated PHP 5->7 extension diff From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e014953ec9cbbd2050e696cf7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Xinchen, On Fri, Feb 6, 2015 at 12:00 PM, Xinchen Hui wrote: > > On Feb 6, 2015, at 9:38 AM, Yasuo Ohgaki wrote: > > > > Hi Rasmus, > > > >> On Fri, Feb 6, 2015 at 7:28 AM, Rasmus Lerdorf > wrote: > >> > >> Having just finished porting php-memcached (with help from Xinchen) to > >> PHP7 I was wondering if it wouldn't be worthwhile to annotate the diff > >> and explain why each change was made. The extension is complicated > >> enough to cover most of the changes the bulk of extension authors need > >> to worry about. > >> > >> The diff is easy enough to grab: > >> > >> git clone https://github.com/php-memcached-dev/php-memcached.git > >> cd php-memcached > >> git checkout php7 > >> git diff master php7 > >> > >> It looks like this: > >> > >> https://gist.github.com/anonymous/15cbc9947edb4f0a71fd > > > > It uses session save handler uses PS_MOD() which is legacy. > > I may help to adopt PS_MOD_TIMESTAMP(). > > It eliminates writes and boost session performance a lot if apps > > do not update session data always. > > > nice=EF=BC=8Cthanks > btw did you bench your optimization on file handler against Wordpress? No I don't, but I have some numbers. https://github.com/php/php-src/pull/1016 ----------------------------------------------- I've tried to get some benchmarks. It seems current system is too fast to get obvious performance difference. Test command: ab -c 7 -n 500000 http://localhost:8888/session.php Test script: 0]); // Change mode here //$_SESSION['test'] =3D ++$_SESSION['test']; $_SESSION['a'] =3D str_repeat('a', 102400); echo '
';
var_dump(session_id(), $_SESSION['test']);


Old behavior was around 15000 reqs/sec.
"read_and_close" improved it to about 20000 reqs/sec. i.e 33% faster.
"lazy_write" did not improve # of reqs, but per process httpd disk writes
was reduced from 100 MB/s to 5 MB/s. i.e. There were 12 httpd processes,
1200 MB/s writes was reduced to 60 MB/s writes.

I think this would be good enough benchmark for merging.
-----------------------------------------------

As you can see, lazy_write didn't improve files much. The reason is my
current Linux
kernel already does lazy_write for files aren't changed. I'm using Fedora
21 x86_64.

However, per process writes are reduced from 1200MB/s to 60MB/s writes.
60MB/s
writes includes writes to log. This means network traffic will be reduced.
It should
help many apps use memcached save handler.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

--089e014953ec9cbbd2050e696cf7--