您的位置:首页 > 运维架构 > Nginx

apache、Nginx、Mongoose 静态页面性能对比

2014-09-08 01:04 483 查看
Mongoose的功能使用,简单验证其性能。
    比对对象:Apache、Nginx与Mongoose;

    比对方法:访问简单静态页面;

    比对结果:用图表说话如下:



    比对结论:Mongoose不适合作为高性能服务器

   关于性能不优的原因,在Mongoose的源码也略有一斑:

    源码:http://code.google.com/p/mongoose/source/browse/mongoose.c

   1、其中包含很多对Windows的兼容;

    2、更关键的是master_thread函数,使用的select方法而非epoll:

if (select(max_fd + 1, &read_set, NULL, NULL, &tv) < 0) {

#ifdef _WIN32

            /*

             * On windows, if read_set and write_set are empty,

             * select() returns "Invalid parameter" error

             * (at least on my Windows XP Pro). So in this case,

             * we sleep here.

             */

            sleep(1);

#endif /* _WIN32 */

        } else {

            for (sp = ctx->listening_sockets;

                    sp != NULL; sp = sp->next)

                if (FD_ISSET(sp->sock, &read_set))

                    accept_new_connection(sp, ctx);

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: