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

 继使用,简单验证其性能。windows

    比对对象:Apache、Nginx与Mongoose;服务器

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

    比对结果:用图表说话以下:mongoose

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

   关于性能不优的缘由,在Mongoose的源码也略有一斑:函数

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

   一、其中包含不少对Windows的兼容;this

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

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);
        }spa

相关文章
相关标签/搜索