基于libmemcached开发php的扩展模块

PHP有个pecl memcached扩展,这是大家默认的选择,对绝大多数应用来说,其实已经够用了,出于学习研究的目的,在朋友小叶的要求下,尝试了利用libmemcached模块来开发一个PHP的扩展。

对于memcached,不在这里多说了,更多的文档可以参照我另外的blog文章或者去memcached官方,在官方文档中,我们可以找到各种语言的APIs,包括已有的pecl memcached API,另外还有Ruby、Perl、C#等API,这次需要用的是C的API,据小叶说,有另外的测试证明基于C API中libmemcached写的Ruby扩展性能比基于libevant写的PHP Pecl Memcached效率高出20倍,这个真实性不去考证了,只准备测试一下用libmemcached来写另外一个PHP的扩展。

这里准备按照最常规的流程来完成这个PHP扩展的开发。目前完整的模块还未写完,只完成了一个测试接口和connect()接口,请有兴趣的朋友随时关注我的更新。

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
8 Responses
  1. Roast says:

    Pecl Memcached Extension基于libevant?
    Memcached 基于libevant,Pecl Memcached Extension是自己实现了Memcached的协议解析吧,而没有使用libmemcached,这和libevant似乎没有太大关系,3.0+的Pecl Memcached Extension 加入了新的MemcachePool实现,代码写得挺不错的,不过两者的效率倒还没测试过,期待你的新扩展出现…:)

  2. Michael says:

    刚才简单看了一下pecl memcached扩展的代码(http://cvs.php.net/viewvc.cgi/pecl/memcache/memcache.c?content-type=text%2Fplain&view=co),的确如楼上朋友所说,倒是了解到memcached是用到libevent的,具体的从这里可以看到:http://cvs.php.net/viewvc.cgi/pecl/memcache/README?revision=1.3.2.1&view=markup

  3. 逆雪寒 says:

    libmemcached 刚推出来。 ruby 就用它开发了 ruby 的memcache的最新扩展,测试了说性能很好。呵呵我也是看介绍这样说的。Michael 大哥人很好。在这里也要谢谢Michael 对我的帮助。也期待你的libmemcache 新扩展。今天我要搬家。顺便来看看。我顶

  4. flashjay says:

    为什么类似的文章老是没有下文呢 。。汗。。。

  5. Michael says:

    [Comment ID #26048 Will Be Quoted Here]

    抱歉,没有来得及更新,asd 朋友告知有了一个已经开发好的,放我一下子丧失了太多热情,又因为最近实在事情太多,把热情和紧急度更高的事情先安排了,空了一定会补齐的。

  6. 逆雪寒 says:

    呵呵。我是asd 。老大忙。肯定没那么快更新拉。你以为老大专业出教程的呀? 老大不用急。哈哈

  7. Michael says:

    [Comment ID #26053 Will Be Quoted Here]

    本来是帮asd顺手给弄出来的,结果没想后来因工作耽误了,ads兄弟确跑到我前面去了,对不住大家了,朋友们可以去asd的站上看他刚写出来的完整的扩展代码,地址在这里: http://www.laoniphp.com/

  8. edwardhey says:

    Michael大哥,请教个问题:

    在编写扩展的时候

    PHP_FUNCTION(test)
    {

    zval *var;
    char *st=””;
    int st_len=0;

    zend_bool i = 0;
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, “z|sb”, &var,&st, &st_len,&i) == FAILURE)
    {
    RETURN_FALSE;
    }

    //我想让程序退出,就好像调用php的 exit()或die()函数; 请问这里该怎么实现呢?
    }

  9. Hi there to all, since I am actually keen of reading this web site’s post to be updated on a
    regular basis. It contains pleasant data.

  10. This design is incredible! You definitely know how to keep a reader amused.

    Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Great job.
    I really loved what you had to say, and more than that,
    how you presented it. Too cool!

  11. Hi there, yup this post is genuinely pleasant and I
    have learned lot of things from it on the topic of blogging.
    thanks.

  12. g says:

    This is very interesting, You are a very skilled blogger.
    I’ve joined your feed and look forward to seeking more of your fantastic post.
    Also, I have shared your website in my social networks!

  13. g says:

    Great delivery. Sound arguments. Keep up the great effort.

  14. Hey there would you mind letting me know which web host you’re working with?
    I’ve loaded your blog in 3 different web browsers and I must say this blog loads a lot faster then most.
    Can you recommend a good hosting provider at a honest price?
    Thanks a lot, I appreciate it!

  15. What’s up, after reading this amazing paragraph i am as well
    delighted to share my familiarity here with colleagues.

  16. Hello There. I discovered your blog using msn. That is a really smartly written article.
    I’ll make sure to bookmark it and come back to read more of your useful information. Thank you for the post.
    I’ll certainly return.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image