卡桑德拉群集读取速度慢

时间:2019-04-02 07:34:53

标签: cassandra datastax cassandra-3.0

我已经从一个单节点转移到了三个节点的cassandra集群。根据文档,读取等待时间应该减少,并且我应该能够更高效地获取数据。但是它花费的时间比以前要长。


RF = 2
MEMTABLE SIZE = 2GB
HEAP SIZE = 8GB

我已经共享了我运行查询的日志

从locationinfohash中选择*,其中pkhash ='34AAB6D5F1431151212AF721F951057F';

我可以看到它从两个节点读取并在内存表和稳定表中查找数据。

更新1:此local_one一致性(读取)和写入跟踪均已完成 共享两个跟踪会话。

我无法找出为什么要花费这么多时间来获取数据以及为什么要从2个节点中获取数据。

Tracing session: 2e9c6060-560b-11e9-83a5-4bbd3b5675f1

 activity                                                                                                                 | timestamp                  | source      | source_elapsed | client
--------------------------------------------------------------------------------------------------------------------------+----------------------------+-------------+----------------+-------------
                                                                                                       Execute CQL3 query | 2019-04-03 12:22:43.814000 | 10.10.10.10 |              0 | 10.10.10.10
                                         READ message received from /10.10.10.10 [MessagingService-Incoming-/10.10.10.10] | 2019-04-03 12:22:40.601000 | 10.10.10.11 |             13 | 10.10.10.10
                                                       Executing single-partition query on locationinfohash [ReadStage-3] | 2019-04-03 12:22:40.602000 | 10.10.10.11 |            571 | 10.10.10.10
                                                                               Acquiring sstable references [ReadStage-3] | 2019-04-03 12:22:40.602000 | 10.10.10.11 |            657 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 5366 [ReadStage-3] | 2019-04-03 12:22:40.602000 | 10.10.10.11 |            757 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 5365 [ReadStage-3] | 2019-04-03 12:22:40.602000 | 10.10.10.11 |            803 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 5348 [ReadStage-3] | 2019-04-03 12:22:40.602000 | 10.10.10.11 |            836 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 5310 [ReadStage-3] | 2019-04-03 12:22:40.602000 | 10.10.10.11 |            875 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 5166 [ReadStage-3] | 2019-04-03 12:22:40.602001 | 10.10.10.11 |            928 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 5029 [ReadStage-3] | 2019-04-03 12:22:40.602001 | 10.10.10.11 |            969 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 4472 [ReadStage-3] | 2019-04-03 12:22:40.602001 | 10.10.10.11 |           1004 | 10.10.10.10
                                                      Partition index with 5 entries found for sstable 3961 [ReadStage-3] | 2019-04-03 12:22:40.602001 | 10.10.10.11 |           1335 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 2660 [ReadStage-3] | 2019-04-03 12:22:40.603000 | 10.10.10.11 |           1876 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 2939 [ReadStage-3] | 2019-04-03 12:22:40.603000 | 10.10.10.11 |           1945 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 2899 [ReadStage-3] | 2019-04-03 12:22:40.603000 | 10.10.10.11 |           1996 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 2651 [ReadStage-3] | 2019-04-03 12:22:40.603000 | 10.10.10.11 |           2041 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 1259 [ReadStage-3] | 2019-04-03 12:22:40.603000 | 10.10.10.11 |           2092 | 10.10.10.10
                                 Skipped 0/13 non-slice-intersecting sstables, included 0 due to tombstones [ReadStage-3] | 2019-04-03 12:22:40.603000 | 10.10.10.11 |           2141 | 10.10.10.10
                                                                  Merged data from memtables and 1 sstables [ReadStage-3] | 2019-04-03 12:22:40.661000 | 10.10.10.11 |          59966 | 10.10.10.10
                                                                  Read 1233 live rows and 0 tombstone cells [ReadStage-3] | 2019-04-03 12:22:40.662000 | 10.10.10.11 |          60613 | 10.10.10.10
                                                                         Enqueuing response to /10.10.10.10 [ReadStage-3] | 2019-04-03 12:22:40.662000 | 10.10.10.11 |          60681 | 10.10.10.10
                          Sending REQUEST_RESPONSE message to /10.10.10.10 [MessagingService-Outgoing-/10.10.10.10-Large] | 2019-04-03 12:22:40.662000 | 10.10.10.11 |          61228 | 10.10.10.10
                                         READ message received from /10.10.10.10 [MessagingService-Incoming-/10.10.10.10] | 2019-04-03 12:22:42.632000 | 10.10.10.12 |             17 | 10.10.10.10
                                                       Executing single-partition query on locationinfohash [ReadStage-7] | 2019-04-03 12:22:42.633000 | 10.10.10.12 |            933 | 10.10.10.10
                                                                               Acquiring sstable references [ReadStage-7] | 2019-04-03 12:22:42.633000 | 10.10.10.12 |            999 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8427 [ReadStage-7] | 2019-04-03 12:22:42.633000 | 10.10.10.12 |           1619 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8426 [ReadStage-7] | 2019-04-03 12:22:42.634000 | 10.10.10.12 |           2125 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8425 [ReadStage-7] | 2019-04-03 12:22:42.634000 | 10.10.10.12 |           2168 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8424 [ReadStage-7] | 2019-04-03 12:22:42.634000 | 10.10.10.12 |           2197 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8423 [ReadStage-7] | 2019-04-03 12:22:42.634000 | 10.10.10.12 |           2224 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8422 [ReadStage-7] | 2019-04-03 12:22:42.634000 | 10.10.10.12 |           2251 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8421 [ReadStage-7] | 2019-04-03 12:22:42.634000 | 10.10.10.12 |           2290 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8420 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2318 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8419 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2347 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8418 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2381 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8417 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2409 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8416 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2437 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8415 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2463 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8414 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2491 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8413 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2519 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8412 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2546 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8411 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2573 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8410 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2605 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8409 [ReadStage-7] | 2019-04-03 12:22:42.634001 | 10.10.10.12 |           2633 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8408 [ReadStage-7] | 2019-04-03 12:22:42.634002 | 10.10.10.12 |           2661 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8407 [ReadStage-7] | 2019-04-03 12:22:42.634002 | 10.10.10.12 |           2688 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8406 [ReadStage-7] | 2019-04-03 12:22:42.635000 | 10.10.10.12 |           2727 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8405 [ReadStage-7] | 2019-04-03 12:22:42.635000 | 10.10.10.12 |           2771 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8404 [ReadStage-7] | 2019-04-03 12:22:42.635000 | 10.10.10.12 |           2929 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8403 [ReadStage-7] | 2019-04-03 12:22:42.635000 | 10.10.10.12 |           3043 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8402 [ReadStage-7] | 2019-04-03 12:22:42.635000 | 10.10.10.12 |           3466 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8401 [ReadStage-7] | 2019-04-03 12:22:42.635000 | 10.10.10.12 |           3521 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8400 [ReadStage-7] | 2019-04-03 12:22:42.635001 | 10.10.10.12 |           3567 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8399 [ReadStage-7] | 2019-04-03 12:22:42.635001 | 10.10.10.12 |           3615 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8398 [ReadStage-7] | 2019-04-03 12:22:42.635001 | 10.10.10.12 |           3676 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8397 [ReadStage-7] | 2019-04-03 12:22:42.636000 | 10.10.10.12 |           3722 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8396 [ReadStage-7] | 2019-04-03 12:22:42.636000 | 10.10.10.12 |           3764 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8395 [ReadStage-7] | 2019-04-03 12:22:42.636000 | 10.10.10.12 |           3810 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8394 [ReadStage-7] | 2019-04-03 12:22:42.636000 | 10.10.10.12 |           3852 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8393 [ReadStage-7] | 2019-04-03 12:22:42.636000 | 10.10.10.12 |           3896 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8392 [ReadStage-7] | 2019-04-03 12:22:42.636000 | 10.10.10.12 |           3941 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8391 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           3979 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8390 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           4006 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8389 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           4033 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8388 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           4061 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8387 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           4105 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8386 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           4136 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8385 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           4164 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8384 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           4190 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8383 [ReadStage-7] | 2019-04-03 12:22:42.636001 | 10.10.10.12 |           4217 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8382 [ReadStage-7] | 2019-04-03 12:22:42.636002 | 10.10.10.12 |           4255 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8381 [ReadStage-7] | 2019-04-03 12:22:42.636002 | 10.10.10.12 |           4282 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8380 [ReadStage-7] | 2019-04-03 12:22:42.636002 | 10.10.10.12 |           4311 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8379 [ReadStage-7] | 2019-04-03 12:22:42.636002 | 10.10.10.12 |           4338 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8378 [ReadStage-7] | 2019-04-03 12:22:42.636002 | 10.10.10.12 |           4380 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 8348 [ReadStage-7] | 2019-04-03 12:22:42.636002 | 10.10.10.12 |           4424 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 7781 [ReadStage-7] | 2019-04-03 12:22:42.636002 | 10.10.10.12 |           4475 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 7253 [ReadStage-7] | 2019-04-03 12:22:42.636002 | 10.10.10.12 |           4520 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 6704 [ReadStage-7] | 2019-04-03 12:22:42.637000 | 10.10.10.12 |           5603 | 10.10.10.10
                                                      Partition index with 5 entries found for sstable 6223 [ReadStage-7] | 2019-04-03 12:22:42.638000 | 10.10.10.12 |           5757 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 4263 [ReadStage-7] | 2019-04-03 12:22:42.641000 | 10.10.10.12 |           9393 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 4598 [ReadStage-7] | 2019-04-03 12:22:42.641000 | 10.10.10.12 |           9470 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 4258 [ReadStage-7] | 2019-04-03 12:22:42.641000 | 10.10.10.12 |           9503 | 10.10.10.10
                                                                  Bloom filter allows skipping sstable 4265 [ReadStage-7] | 2019-04-03 12:22:42.641001 | 10.10.10.12 |           9532 | 10.10.10.10
                                 Skipped 0/59 non-slice-intersecting sstables, included 0 due to tombstones [ReadStage-7] | 2019-04-03 12:22:42.641001 | 10.10.10.12 |           9562 | 10.10.10.10
                                                                  Merged data from memtables and 1 sstables [ReadStage-7] | 2019-04-03 12:22:42.708000 | 10.10.10.12 |          76713 | 10.10.10.10
                                                                  Read 1233 live rows and 0 tombstone cells [ReadStage-7] | 2019-04-03 12:22:42.709000 | 10.10.10.12 |          77406 | 10.10.10.10
                                                                         Enqueuing response to /10.10.10.10 [ReadStage-7] | 2019-04-03 12:22:42.709000 | 10.10.10.12 |          77503 | 10.10.10.10
                          Sending REQUEST_RESPONSE message to /10.10.10.10 [MessagingService-Outgoing-/10.10.10.10-Large] | 2019-04-03 12:22:42.710000 | 10.10.10.12 |          78298 | 10.10.10.10
 Parsing select * from locationinfohash WHERE pkhash = '118BF26BD7FDF182DEC316296A8B1945'; [Native-Transport-Requests-20] | 2019-04-03 12:22:43.814000 | 10.10.10.10 |            101 | 10.10.10.10
                                                                       Preparing statement [Native-Transport-Requests-20] | 2019-04-03 12:22:43.814000 | 10.10.10.10 |            157 | 10.10.10.10
                                                            reading data from /10.10.10.11 [Native-Transport-Requests-20] | 2019-04-03 12:22:43.814000 | 10.10.10.10 |            433 | 10.10.10.10
                                                    speculating read retry on /10.10.10.12 [Native-Transport-Requests-20] | 2019-04-03 12:22:43.815000 | 10.10.10.10 |            521 | 10.10.10.10
                                      Sending READ message to /10.10.10.11 [MessagingService-Outgoing-/10.10.10.11-Small] | 2019-04-03 12:22:43.815000 | 10.10.10.10 |            573 | 10.10.10.10
                                      Sending READ message to /10.10.10.12 [MessagingService-Outgoing-/10.10.10.12-Small] | 2019-04-03 12:22:43.815000 | 10.10.10.10 |            594 | 10.10.10.10
                             REQUEST_RESPONSE message received from /10.10.10.11 [MessagingService-Incoming-/10.10.10.11] | 2019-04-03 12:22:43.880000 | 10.10.10.10 |          65915 | 10.10.10.10
                                                           Processing response from /10.10.10.11 [RequestResponseStage-9] | 2019-04-03 12:22:43.880000 | 10.10.10.10 |          66069 | 10.10.10.10
                             REQUEST_RESPONSE message received from /10.10.10.12 [MessagingService-Incoming-/10.10.10.12] | 2019-04-03 12:22:43.905000 | 10.10.10.10 |            145 | 10.10.10.10
                                                           Processing response from /10.10.10.12 [RequestResponseStage-2] | 2019-04-03 12:22:43.906000 | 10.10.10.10 |            270 | 10.10.10.10
                                                                          Initiating read-repair [RequestResponseStage-2] | 2019-04-03 12:22:43.906000 | 10.10.10.10 |            329 | 10.10.10.10
                                                                                                         Request complete | 2019-04-03 12:22:43.892987 | 10.10.10.10 |          78987 | 10.10.10.10

编辑1:

CREATE TABLE trackfleet_db.locationinfohash (
    pkhash text,
    gpsdt timestamp,
    dt timestamp,
    gpsdtt bigint,
    id text,
    lastgpsdt timestamp,
    latitude double,
    longitude double,
    odo int,
    odometer int,
    port int,
    speed int,
    srtangle int,
    stats map<text, int>,
    stoppageflag int,
    PRIMARY KEY (pkhash, gpsdt)
) WITH CLUSTERING ORDER BY (gpsdt ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy', 'compaction_window_size': '1', 'compaction_window_unit': 'DAYS', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

0 个答案:

没有答案