Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not need to connect every time. #32

Open
fxconfig opened this issue Aug 20, 2020 · 2 comments
Open

Do not need to connect every time. #32

fxconfig opened this issue Aug 20, 2020 · 2 comments

Comments

@fxconfig
Copy link

关于这个项目的 todo list 里的这一条,我认为还是很有必要的。

我引用这个项目,将股票期货报价数据写入到 InfluxDB 里面去,每一个报价都 Post 一次,Post 里面又包含了 sock 的创建连接等,显然太占用资源了。

我将 server_info struct 里面添加了 sock addr 两个变量,
添加了 DoConnect DoWritev DoRecv 三个方法,替代你的项目里面的 http_request 内的创建 socket, connect sock 以及writev 和 recv 。
唯一有一个缺点就是无法在应该关闭 sock 重连的时候(远端关闭,send recv的其他异常错误)而关闭 sock 并重新创建并连接

@orca-zhang
Copy link
Owner

是的,最好能实现成连接池

@advra
Copy link

advra commented Nov 17, 2020

The readme suggest we need to reconnect every time. Does the library reconnect to the database on each builder call? If so, is it recommended to put a builder for every thread?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants