hive线程数详解

打印 上一主题 下一主题

主题 906|帖子 906|积分 2718

参考社区:
https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties
https://issues.apache.org/jira/browse/HIVE-5229
HS2的主要改进是把MetaStoreServer从Hiveserver中剥离出来了,形成一个单独的进程运行。
而且hiveserver和metastore server可以同时服务于多个客户端(Beeline CLI,Hive CLI,HCatalog等)。
hiveserver2最大连接数设置:
hive.server2.thrift.max.worker.threads 默认值500,Maximum number of Thrift worker threads
但是这些连接不能同时发出哀求,受以下两个参数的控制。
hive.server2.async.exec.wait.queue.size 默认100,是等候队列的长度,HiveServer2 收到哀求后,先放到等候队列里。假如队列已满,则抛出异常。
hive.server2.async.exec.threads 默认100,设置计算线程的数量。计算线程从等候队列中取哀求,举行处理。这些哀求不一定都提交到集群上,如 show databases。
metastore连接池数量设置:
datanucleus.connectionPool.maxPoolSize 缺省值为10,假如poolSize=100,有3个HMS实例,每个服务器有4个池,则可以容纳1200个连接。
mysql /etc/my.conf max_connections = 3000 默认151,最大用户连接数建议3000
其他优化线程数设置:
hive.metastore.fshandler.threads 缺省值为15,用于在MSCK阶段中扫描分区的线程数。
hive.mv.files.thread 默认值为15,插入数据时线程数,Hive将数据从临时文件夹移动到终极位置,这个移动操纵现实上是一个复制+删除操纵。
hive.compactor.worker.threads 默认值为0,在这个metastore实例上运行多少个归并工作线程。支持事件时至少在一个Metastore实例上大于0。
hive.load.dynamic.partitions.thread 默认值为15,用于加载动态天生的分区的线程数。加载必要将文件重命名为它的终极位置,并更新关于新分区的一些元数据。当有大量动态天生的分区时,增加这个值可以提高性能。根据服务器设置修改。
hive.exec.input.listing.max.threads 默认值为15,Hive用来监听输入文件的最大线程数。当必要读取大量分区时,增加这个值可以提高性能。根据服务器设置举行调解
hive.driver.parallel.compilation.global.limit 0或负值为无限定,同时编译查询并发。Hive默认同时只能编译一段HiveQL,并上锁。将hive.driver.parallel.compilation设置为true,各个会话可以同时编译查询,提高工作效。否则假如在UDF中实行了一段HiveQL,或者多个用户同时使用的话, 就会锁住。
hive.exec.max.dynamic.partitions 默认值为1000,表现一个动态分区语句可以创建的最大动态分区个数,超出报错。spark-sql需指定 --hiveconf hive.exec.max.dynamic.partitions=10000
hive.exec.max.dynamic.partitions.pernode=100 默认100,一样平常可以设置大一点,比如1000。表现每个maper或reducer可以允许创建的最大动态分区个数,默认是100,超出则会报错。
hive.exec.max.created.files =10000默认10000,全局可以创建的最大文件个数,超出报错。
假如抛出以下错误,则建议调大 hive.server2.async.exec.wait.queue.size。
rg.apache.hive.service.cli.HiveSQLException: java.lang.RuntimeException: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@6ef9d564 rejected from java.util.concurrent.ThreadPoolExecutor@6e2c02d2[Running, pool size = 100, active threads = 100, queued tasks = 100, completed tasks = 234]
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:300)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:286)
at org.apache.hive.jdbc.HiveStatement.runAsyncOnServer(HiveStatement.java:324)
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:265)
at org.apache.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:497)
at com.baidu.hive.jdbc.MultiThreadStatementTest.execute(MultiThreadStatementTest.java:82)
at com.baidu.hive.jdbc.MultiThreadStatementTest.lambda$parallelExecute                                   0                         (                         M                         u                         l                         t                         i                         T                         h                         r                         e                         a                         d                         S                         t                         a                         t                         e                         m                         e                         n                         t                         T                         e                         s                         t                         .                         j                         a                         v                         a                         :                         56                         )                         a                         t                         j                         a                         v                         a                         .                         u                         t                         i                         l                         .                         c                         o                         n                         c                         u                         r                         r                         e                         n                         t                         .                         E                         x                         e                         c                         u                         t                         o                         r                         s                              0(MultiThreadStatementTest.java:56) at java.util.concurrent.Executors                  0(MultiThreadStatementTest.java:56)atjava.util.concurrent.ExecutorsRunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Hive连接数详解
HS2连接设置:
设置Hiveserver2的访问协议,http或者tcp
hive.server2.transport.mode
binary
Server transport mode. “binary” or “http”.
对应http协议的访问端口
hive.server2.thrift.http.port
10001
Port number when in HTTP mode.
对应tcp协议的访问端口
hive.server2.thrift.port
10000
Port number when in TCP mode.
对应在http协议下线程池的线程数
hive.server2.thrift.http.min.worker.threads
5
Minimum number of worker threads when in HTTP mode.
hive.server2.thrift.http.max.worker.threads
500
Maximum number of worker threads when in HTTP mode.
对应在tcp协议下的线程池的线程数:
hive.server2.thrift.min.worker.threads
5
Minimum number of worker threads when in TCP mode.
hive.server2.thrift.max.worker.threads
500
Maximum number of worker threads when in TCP mode.
设置异步线程池的线程数
hive.server2.async.exec.threads
100
Number of threads in the async thread pool for HiveServer2
设置异步线程结束的超时时间(超过这个时间HS会退出):
hive.server2.async.exec.shutdown.timeout
10
Time (in seconds) for which HiveServer2 shutdown will wait for async
threads to terminate
设置异步线程的等候超时时间(超过这个值线程会被回收)
hive.server2.async.exec.keepalive.time
10
Time (in seconds) that an idle HiveServer2 async thread (from the thread pool) will wait
for a new task to arrive before terminating
hive.server2.long.polling.timeout
5000L
Time in milliseconds that HiveServer2 will wait, before responding to asynchronous calls that use long polling
设置哀求缓冲队列的长度
hive.server2.async.exec.wait.queue.size
100
Size of the wait queue for async thread pool in HiveServer2.
After hitting this limit, the async thread pool will reject new requests.

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

半亩花草

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表