大型结果会在本地以外的任何地方变慢

时间:2019-09-06 12:29:08

标签: clickhouse

我在Clickhouse上运行了一个相当大的查询。问题是,使用cmd行在本地主机上运行时,大约需要0.7秒才能完成。这始终是快速的。问题是从C#/ HTTP / Postman查询时。在这里,大约需要10次返回数据。 (大小约为3-4mb),所以我认为这不是大小问题。

我已经尝试监视网络延迟,但是这里没有引起注意。 在主机上,它像一个咒语一样工作,但在外部它却不是:(....该怎么办。

我预计等待时间为几百毫秒,但结果是7秒:/

2 个答案:

答案 0 :(得分:0)

使用卷曲https://clickhouse.yandex/docs/en/interfaces/http/检查时间 https://stackoverflow.com/a/22625150

比较本地和远程

CH HTTP通常提供几乎与TCP相同的性能,而对于较小的结果集(如10行),HTTP可能会更快

答案 1 :(得分:0)

Again. The problem is not the HTTP.
Example:

time clickhouse-client -q "select number, arrayMap(x->sipHash64(number,x), range(10)) from numbers(10000)" >native.out
real    0m0.034s

time curl -S -o http.out 'http://localhost:8123/?query=select%20number%2C%20arrayMap(x-%3EsipHash64(number%2Cx)%2C%20range(10))%20from%20numbers(10000)'
real    0m0.017s

ls -l http.out native.out
2108707 Oct  1 16:17 http.out
2108707 Oct  1 16:17 native.out

10 000 rows - 2Mb

HTTP is faster 0.017s VS 0.034s

加拿大->德国(openvpn)

time curl -S -o http.out 'http://user:xxx@cl.host.x:8123/?query=select%20number%2C%20arrayMap(x-%3EsipHash64(number%2Cx)%2C%20range(10))%20from%20numbers(10000)'

real    0m1.619s

ping cl.host.x
PING cl.host.x (10.253.52.6): 56 data bytes
64 bytes from 10.253.52.6: icmp_seq=0 ttl=61 time=131.710 ms
64 bytes from 10.253.52.6: icmp_seq=1 ttl=61 time=133.711 ms