基于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.

  17. Hi there, I enjoy reading all of your article post. I wanted to write a
    little comment to support you.

  18. Hello, always i used to check weblog posts here early in the morning,
    because i love to gain knowledge of more and more.

  19. certainly like your web-site however you have to test the spelling on quite a few of your posts.
    A number of them are rife with spelling issues and I find it very bothersome to tell the truth then again I’ll certainly come
    back again.

  20. you’re in reality a excellent webmaster. The web site loading pace
    is incredible. It seems that you are doing any distinctive trick.

    Moreover, The contents are masterpiece. you have performed a magnificent process in this topic!

  21. wonderful post, very informative. I wonder why the opposite experts of this sector do not realize this.

    You must continue your writing. I am confident, you have a huge readers’ base already!

  22. I read this piece of writing completely regarding the comparison of most up-to-date and preceding technologies, it’s remarkable
    article.

  23. What’s up friends, how is everything, and what you would like to say regarding this piece of writing, in my view
    its in fact amazing for me.

  24. Hello, I want to subscribe for this weblog to get newest updates,
    therefore where can i do it please help out.

  25. It’s very simple to find out any matter on web as compared to books,
    as I found this article at this web site.

  26. dating site says:

    I constantly spent my half an hour to read this blog’s content every day along with
    a cup of coffee.

  27. Yes! Finally someone writes about plenty of fish dating site.

  28. Hey I am so delighted I found your webpage, I really found you by error, while I was searching on Yahoo for something
    else, Anyhow I am here now and would just like to say thanks a lot for a marvelous post and a all round exciting blog (I also love the theme/design), I don’t have time to read through it all at the moment but I have saved it and also added in your RSS
    feeds, so when I have time I will be back to read
    much more, Please do keep up the superb job.

  29. RonaldNeink says:

    You made your position quite effectively!!
    canadian drugs
    canadian pharmacy online canada – https://www.canadianonlinepharmacytrust.com/

    price prescription drugs ka 2241cf4

  30. Hi! I’m at work surfing around your blog from my new apple iphone!

    Just wanted to say I love reading through
    your blog and look forward to all your posts! Keep up the
    outstanding work!

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