c++ - difference between core connections and i/o threads in Datastax Cassandra C++ driver
问题描述
I set number of core connections per host using cass_cluster_set_max_connections_per_host()
and i/o threads using cass_cluster_set_num_threads_io()
.
I see that my client host is establishing,
core connections * num i/o threads, number of tcp connections with each host in my cluster using netstat command. I am wondering what is the difference between an i/o thread and a core connection? Also, if a client is communicating with Cassandra cluster of 10 hosts and number of core connections is set to 2, i/o threads is set to 4 then there are essentially 10*4*2, 80 connections established from a host to cluster - and this all in single session, how are those connections utilized? doesn't it seem extraneous?
I am trying to tune those values so if a cluster is connected by 100 hosts simultaneously then the speed wouldn't slow down. Or are those settings unrelated to speed? Any more information or links are appreciated!
解决方案
这是此处存在的字段的官方文档
cass_cluster_set_num_threads_io:这是将处理查询请求的线程数。默认值:1
cass_cluster_set_max_connections_per_host:设置每个 IO 线程中每个服务器的最大连接数。默认值:2
我想知道 i/o 线程和核心连接有什么区别?
I/O 线程基本上负责做客户端和服务器之间的所有网络操作。因此,如果您有 1000 条消息等待网络操作,该线程将一一挑选请求并执行它们。默认值为 1。
一旦 I/O 线程选择了一条消息,它就会使用set_max_connections中指定的连接来发出请求。默认值为 2,以便 I/O 线程可以根据服务器延迟和吞吐量智能地切换连接。
我正在尝试调整这些值,因此如果一个集群同时由 100 个主机连接,那么速度不会减慢。
您可以保持最大连接不变并增加 i/o 线程的数量,或者以相反的方式进行缩放。两者之间没有明确的更好的方法。您需要进行基准测试,看看哪种方法适合您的情况。
我认为,如果您的请求数量较少但请求数量很大,那么增加连接数量更有意义,但仍然需要进行基准测试。
此链接还提供了一些额外的信息。
推荐阅读
- git - 我是否需要克隆存储库以添加自定义分支
- php - 以 php 格式导出 csv,如 Microsoft excel 格式
- hadoop3 - hadoop 3.3.1 显示作业历史错误:线程“主”java.lang.IllegalArgumentException 中的异常:JobId 字符串:/output_dir 格式不正确
- vb.net - VS - vb 文件已损坏 - 意外的令牌和字符无效
- c# - 在 Azure Devops 管道中使用 Cosmos Db 进行单元测试失败
- javascript - 我使用 npm run build 后代理不起作用
- javascript - 自定义突出显示功能不适用于特殊字符 - React Native
- c++ - 尽管使用 C++ 17,为什么我无法用 shared_ptr 包装动态数组?
- python - 我想通过 python selenium 库显示 **href** 上下文 1,2,3,4,5,6,7,8,9
- javascript - 如何解析 JSON (Google Analytics API 4)