Code Monkey home page Code Monkey logo

Comments (6)

chanchann avatar chanchann commented on May 18, 2024 1

Experiment code here: https://github.com/chanchann/workflow_annotation/tree/main/demos/08_max_con

from workflow.

Barenboim avatar Barenboim commented on May 18, 2024

这个简单。state == SYS_ERROR, error = EAGAIN。说明没有连接可以用了。改一下global settings,把max_connections改到1000以上。这个值默认为200

from workflow.

Barenboim avatar Barenboim commented on May 18, 2024

struct WFGlobalSettings settings = GLOBAL_SETTINGS_DEFAULT;
settings.endpoint_params.max_connections = 1024;
WORKFLOW_library_init(&settings);

from workflow.

Barenboim avatar Barenboim commented on May 18, 2024

这个参数指的是对单个ip:port的最大并发连接数,所以其实很少需要太大。

from workflow.

Barenboim avatar Barenboim commented on May 18, 2024

补充一点,http server端模拟慢请求,不要在process里调用sleep函数,最好使用定时器任务:

void process(WFHttpTask *server_task)
{
    server_task->get_resp()->append_output_body(“Hello World!”);
    series_of(server_task)->push_back(WFTaskFactory::create_timer_task(5*1000*1000, nullptr));
}

以上代码实现一个延迟5秒返回的http server。等待时间不占用线程。

from workflow.

duyixian1234 avatar duyixian1234 commented on May 18, 2024

十分感谢。解决了问题。 @Barenboim

from workflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.