Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82045 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55638 invoked from network); 6 Feb 2015 14:39:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2015 14:39:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.180 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.217.180 mail-lb0-f180.google.com Received: from [209.85.217.180] ([209.85.217.180:39203] helo=mail-lb0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/24-45146-A02D4D45 for ; Fri, 06 Feb 2015 09:39:07 -0500 Received: by mail-lb0-f180.google.com with SMTP id b6so18271611lbj.11 for ; Fri, 06 Feb 2015 06:39:03 -0800 (PST) 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:content-type:content-transfer-encoding; bh=WjkMgvHGTPX9zuGM6Yz93YCR3yE7Vz7rrYilMSHlkd0=; b=0RGdcWsBMcwBin/kiO5jjBa7iEQmWqhMD32Dhd6HbvDIfCIhVmNz6EKM3xxrQuvnrb WAW/yXO92epR7Lv93/nTlsqxuyAeQ6nuvh6h4D8aJIUz6wQhurCrkjLA4cjk5bmu4vIg BL/RFn5TuDziMfJ5/aZiRUJnGwq/r2XD7QktQ/C2MOC+Qo0BT76VTYyqNtFf5OenrP7g JtncMJtqAeiW+J1rIwbxwPd6VsEGqJ2nT0S4ubM+tk8hHTw51sEExYP9WiWhOif1Dg55 3b/Exqh4jnVRIN3dH1q1h+sDkdCi0B8eXrFeOGp7lR6Mr8uS/sMSsAxXcWAe7Gb5phCY 2pqQ== X-Received: by 10.112.26.110 with SMTP id k14mr3011210lbg.29.1423233542930; Fri, 06 Feb 2015 06:39:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.28.193 with HTTP; Fri, 6 Feb 2015 06:38:41 -0800 (PST) In-Reply-To: References: <54D3EE95.2080109@lerdorf.com> Date: Fri, 6 Feb 2015 22:38:41 +0800 Message-ID: To: Yasuo Ohgaki Cc: Rasmus Lerdorf , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Annotated PHP 5->7 extension diff From: laruence@gmail.com (Xinchen Hui) Hey: On Fri, Feb 6, 2015 at 7:06 PM, Yasuo Ohgaki wrote: > 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) t= o >> >> PHP7 I was wondering if it wouldn't be worthwhile to annotate the dif= f >> >> and explain why each change was made. The extension is complicated >> >> enough to cover most of the changes the bulk of extension authors nee= d >> >> 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: > > ini_set('session.save_path', '/home/tmp'); > ini_set('session.lazy_write', 1); // Change mode here > ini_set('session.use_strict_mode', 0); > > session_id('testid'); > session_start(['read_and_close'=3D>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.
>
I've benched wordpress, didn't see any obviously speedup.

thanks
> Regards,
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net



--=20
Xinchen Hui
@Laruence
http://www.laruence.com/