Operations Tips
1.cpu
cpu需要支持SSE4.2指令集。
对于clickhouse来说,cpu数是很重要的,即便cpu计算速度慢一些,也是cpu的数量是对速度的首要影响因素。
2.超线程技术 hyper-threading
不要关闭超线程技术,一些查询在超线程技术上会查询速度很快,但不是针对所有的查询。
3.turbo-boost
同上,不要关闭turbo-boost 这些都是cpu的技术,能打开都打开。
4.cpu throttling
cpu可能会过热
5.RAM
对于小数据量的查询,最好是RAM的大小跟数据卷的大小一致,如果是大数据量,最好是用128G的ram,会比64G的ram快很多。
6.Swap
关掉swap,除非你是用的自己的笔记本电脑
7.Huge pages
关掉huge pages,如果打开会对性能带来很大的阻碍。
8.storage subsystem
能用ssd就用ssd,否则可以用HDD. SATA HDDs 7200 RPM are Ok
9.RAID
当用HDDs时,最好是RAID-10 选择far layout
10 network
最好是10Gbit网络带宽,1Gbit也可以用但是对恢复数据来说 速度会慢很多
11 zookeeper
版本3.5或以上就ok
zoo.cfg
# http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=30000
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=10
maxClientCnxns=2000
maxSessionTimeout=60000000
# the directory where the snapshot is stored.
dataDir=/opt/zookeeper/{{ cluster['name'] }}/data
# Place the dataLogDir to a separate physical disc for better performance
dataLogDir=/opt/zookeeper/{{ cluster['name'] }}/logs
autopurge.snapRetainCount=10
autopurge.purgeInterval=1
# To avoid seeks ZooKeeper allocates space in the transaction log file in
# blocks of preAllocSize kilobytes. The default block size is 64M. One reason
# for changing the size of the blocks is to reduce the block size if snapshots
# are taken more often. (Also, see snapCount).
preAllocSize=131072
# Clients can submit requests faster than ZooKeeper can process them,
# especially if there are a lot of clients. To prevent ZooKeeper from running
# out of memory due to queued requests, ZooKeeper will throttle clients so that
# there is no more than globalOutstandingLimit outstanding requests in the
# system. The default limit is 1,000.ZooKeeper logs transactions to a
# transaction log. After snapCount transactions are written to a log file a
# snapshot is started and a new transaction log file is started. The default
# snapCount is 10,000.
snapCount=3000000
# If this option is defined, requests will be will logged to a trace file named
# traceFile.year.month.day.
#traceFile=
# Leader accepts client connections. Default value is "yes". The leader machine
# coordinates updates. For higher update throughput at thes slight expense of
# read throughput the leader can be configured to not accept clients and focus
# on coordination.
leaderServes=yes
standaloneEnabled=false
dynamicConfigFile=/etc/zookeeper-{{ cluster['name'] }}/conf/zoo.cfg.dynamic
```
在这部分会讲如何对查询进行设置,可以通过交互式客户端来设置这些,但是退出客户端后会失效,因此可以将这些设置放到配置文件中,这样可以始终有效。
1.对查询复杂度的约束(restrictions on query complexity)
这些复杂度的约束只在select语句中,对于分布式的查询来说,各个节点的查询复杂度约束是分开的。