Linux under Ace using Epoll

Source: Internet
Author: User
Tags epoll

The comparison between select and Epoll is not to say much. The ACE uses Select to implement reactor under Linux by default. How to let ace use Epoll under Linux.

1. Add a compiler macro that tells the ACE not to use the default select, but to use Event_poll.

2. Then recompile the project for the ace.

3. When used in your program:

"Ace/dev_poll_reactor.h"    //system to open the file limit for each process, Ulimit-n    Ace_reactor Reactor (&dev_reactor);      //4000 for maximum number    of open Ace_reactor::instance (&reactor);

4. Recompile your program to

You may encounter the following error:

Error:Ace_dev_poll_reactor::open failed inside Ace_dev_poll_reactor::ctor:

This is some of the limitations of Linux and can be configured with new values. The maximum number of descriptors that can be processed by the Epoll is limited by the maximum number of descriptors that can be opened by the user, usually by default of 1024, available ulimit-a view,
Two methods of modification:

1.ulimit-n 5120 #每次登录到shell都要修改, only valid for this login.

2. Modify the/etc/security/limits.conf with the root user, add the following two lines, and then log in again. is globally valid after the repair configuration file.

*     Soft   nofile    5120*     hard   nofile    10240

Linux under Ace using Epoll

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.