Hi Xinchen, On Fri, Feb 6, 2015 at 12:00 PM, Xinchen Hui <larue...@gmail.com> wrote:
> > On Feb 6, 2015, at 9:38 AM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: > > > > Hi Rasmus, > > > >> On Fri, Feb 6, 2015 at 7:28 AM, Rasmus Lerdorf <ras...@lerdorf.com> > 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,thanks > 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: <?php 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'=>0]); // Change mode here //$_SESSION['test'] = ++$_SESSION['test']; $_SESSION['a'] = str_repeat('a', 102400); echo '<pre>'; 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 yohg...@ohgaki.net