So, can you, please, clarify in the documentation, Enterprise or KB, or both, what value to set for spider_casual_read, and on what level, table or global, for each of these 4 cases?
Attachments
Issue Links
includes
MDEV-31787Clean up and code documentation of casual_read related code
Closed
relates to
MDEV-31788Factor out code repeat in functions calling spider_check_and_init_casual_read()
The word "a connection channel" refers to a database connection to a data node (the Spider SE may have multiple channels to a single data node). With more partitions on a Spider table, you would have more chances to leverage parallelism. As the documentation said, this is true even if multiple shards are stored on the same physical server. Please note that it quite depends on how much the response time is reduced by parallel search, so it is best to have the actual measurement done in the user's environment.
Setting spider_casual_read=X (X in [2, 3..., 63]) is to let the Spider storage engine use the specific channel of No. X to each data node. This setting seems to be for fine-tuning and sometimes results in an excessive tweak. So, if one wants to benefit from a parallel read, I recommend setting spider_casual_read = 1 in most cases.
Nayuta Yanagisawa (Inactive)
added a comment - The word "a connection channel" refers to a database connection to a data node (the Spider SE may have multiple channels to a single data node). With more partitions on a Spider table, you would have more chances to leverage parallelism. As the documentation said, this is true even if multiple shards are stored on the same physical server. Please note that it quite depends on how much the response time is reduced by parallel search, so it is best to have the actual measurement done in the user's environment.
Setting spider_casual_read=X (X in [2, 3..., 63]) is to let the Spider storage engine use the specific channel of No. X to each data node. This setting seems to be for fine-tuning and sometimes results in an excessive tweak. So, if one wants to benefit from a parallel read, I recommend setting spider_casual_read = 1 in most cases.
The best way to know for sure the behaviour of this parameter is to find or create a test covering it. I will be working on this.
Yuchen Pei
added a comment - The best way to know for sure the behaviour of this parameter is to find or create a test covering it. I will be working on this.
As I suspected, none of the tests cover the case where spider_check_and_get_casual_read_conn() is called and result_list->casual_read[link_idx] is nonzero. So we have to add a
test.
To make this task more "interesting", spider_check_and_get_casual_read_conn() is only called when bgs_phase is nonzero, which implies bgs_mode is nonzero. This
is why only one test outside of the spider/bg subsuite goes there.
And it is "interesting" because bgs stands for "background search",
yet another undocumented feature in spider.
Yuchen Pei
added a comment - As I suspected, none of the tests cover the case where
spider_check_and_get_casual_read_conn() is called and
result_list->casual_read [link_idx] is nonzero. So we have to add a
test.
To make this task more "interesting",
spider_check_and_get_casual_read_conn() is only called when
bgs_phase is nonzero, which implies bgs_mode is nonzero. This
is why only one test outside of the spider/bg subsuite goes there.
And it is "interesting" because bgs stands for "background search",
yet another undocumented feature in spider.
After looking into the code, and creating, running and inspecting
code paths tests, I am convinced that the casual read is unnecessary
and therefore should always be left alone (i.e. default value 0 i.e.
disabled), because
1. it only takes effect when bgs mode is on (bgs_mode > 0), and
direct_order_limit or direct_aggregate is on
2. when it is enabled and takes effect, spider_check_and_get_casual_read_conn() creates at least one
background thread for each link-query combination, where link is a
data node. I doubt the function spider_check_and_get_casual_read_conn() is ever called more than
once for the same link-query combination*, in which case it creates
exactly one extra background thread. Furthermore, the case where
the connection key is supposed to be incremented due to casual read
value being 1 is likely not gonna happen, because the latter gets
overwritten and I doubt it gets reset when the query_id is not
changed** (it gets reset, for example, at the end of a query,
through ha_spider::reset):
// in spider_check_and_get_casual_read_conn()
if (spider->result_list.casual_read[link_idx] == 1)
if ((error_num = spider_check_and_get_casual_read_conn(thd, spider,
link_idx)))
3. Whenever casual read take effect, a bg thread has been created for
the same purpose already:
// before every call site of spider_check_and_init_casual_read()
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
While working on this ticket, I also did some code cleanup, which I
will finish up and send for review - that is MDEV-31787.
I will also open a ticket to deprecate and remove this sysvar /
table param - that is MDEV-31789.
Disclaimer: this is not a mathematical proof, and rests on the two
assumptions marked with * and ** above.
Update on [2023-07-31 Mon]: Regarding the assumption * above, I did
some experiments, and here's what I got:
1. A relaxed assumption does not hold: we have that the same
conn-query combination can be encountered in spider_check_and_init_casual_read() (not different function
name) more than once, see commit [1] where a bunch of spider/bg
tests fail on the abort()
2. A less relaxed assumption does hold for all tests: the same
conn-query combination is never encountered in spider_check_and_get_casual_read() more than noce, see commit [2] - none of the tests break.
3. Even if the same conn-query combination is encountered more than
once in spider_check_and_get_casual_read() in a specific
query, the existing implementation of casual_read == 1 simply
will create only one extra thread, effectively making it useless.
To see this, note that spider_get_conn() overwrites spider->conn_keys[link_idx] with the new connection, which
has the initial query_id of 0, so the check against thd->query_id will fail and reset the conn_key to 2.
4. To fix 3., we need to make assumptions about the real intention
of casual read. For example, if we assume casual_read == 1 means
creating a new connection/thread for the same link-query, perhaps
we could do something like [3]. But fixing casual read is out of
the scope of this ticket, which has the presmise that the feature
is already implemented properly, nor is it as trivial as [3],
because we don't have testcases that exercise this assumption
(too many conditions required: bgs mode, direct order/aggregate,
entering a specific function at least twice with the same
link-query combination), and the code paths as they are now are
too complicated to understand without such testcases.
So what do we do? I think there are two possible approaches:
1. We take casual read at face value, in which case it is pretty
useless and should be disabled, deprecated and deleted as I
recommended above.
2. We redo the implementation of casual read, before coming back to
this ticket, which is a lot more work.
I still think 1 is much better, as spider code is too legacy and
complex and we should delete code whenever possible, and there does
not seem to be a usecase afaik for adding extra background threads
for each link when there's already one.
Also holyfoot, feel free to chime in if you have thoughts about
this
Yuchen Pei
added a comment - - edited After looking into the code, and creating, running and inspecting
code paths tests, I am convinced that the casual read is unnecessary
and therefore should always be left alone (i.e. default value 0 i.e.
disabled), because
1. it only takes effect when bgs mode is on (bgs_mode > 0), and
direct_order_limit or direct_aggregate is on
2. when it is enabled and takes effect,
spider_check_and_get_casual_read_conn() creates at least one
background thread for each link-query combination, where link is a
data node. I doubt the function
spider_check_and_get_casual_read_conn() is ever called more than
once for the same link-query combination*, in which case it creates
exactly one extra background thread. Furthermore, the case where
the connection key is supposed to be incremented due to casual read
value being 1 is likely not gonna happen, because the latter gets
overwritten and I doubt it gets reset when the query_id is not
changed** (it gets reset, for example, at the end of a query,
through ha_spider::reset):
// in spider_check_and_get_casual_read_conn()
if (spider->result_list.casual_read[link_idx] == 1)
{
spider->result_list.casual_read[link_idx] = conn->casual_read_current_id;
++conn->casual_read_current_id;
// in spider_check_and_init_casual_read(), the caller of spider_check_and_get_casual_read_conn()
if (!result_list->casual_read[link_idx])
{
result_list->casual_read[link_idx] =
spider_param_casual_read(thd, share->casual_read);
}
if ((error_num = spider_check_and_get_casual_read_conn(thd, spider,
link_idx)))
3. Whenever casual read take effect, a bg thread has been created for
the same purpose already:
// before every call site of spider_check_and_init_casual_read()
if ((error_num = spider_set_conn_bg_param( this )))
DBUG_RETURN(error_num);
While working on this ticket, I also did some code cleanup, which I
will finish up and send for review - that is MDEV-31787 .
I will also open a ticket to deprecate and remove this sysvar /
table param - that is MDEV-31789 .
Disclaimer: this is not a mathematical proof, and rests on the two
assumptions marked with * and ** above.
Update on [2023-07-31 Mon] : Regarding the assumption * above, I did
some experiments, and here's what I got:
1. A relaxed assumption does not hold: we have that the same
conn-query combination can be encountered in
spider_check_and_init_casual_read() (not different function
name) more than once, see commit [1] where a bunch of spider/bg
tests fail on the abort()
2. A less relaxed assumption does hold for all tests: the same
conn-query combination is never encountered in
spider_check_and_get_casual_read() more than noce, see commit
[2] - none of the tests break.
3. Even if the same conn-query combination is encountered more than
once in spider_check_and_get_casual_read() in a specific
query, the existing implementation of casual_read == 1 simply
will create only one extra thread, effectively making it useless.
To see this, note that spider_get_conn() overwrites
spider->conn_keys [link_idx] with the new connection, which
has the initial query_id of 0, so the check against
thd->query_id will fail and reset the conn_key to 2.
4. To fix 3., we need to make assumptions about the real intention
of casual read. For example, if we assume casual_read == 1 means
creating a new connection/thread for the same link-query, perhaps
we could do something like [3] . But fixing casual read is out of
the scope of this ticket, which has the presmise that the feature
is already implemented properly, nor is it as trivial as [3] ,
because we don't have testcases that exercise this assumption
(too many conditions required: bgs mode, direct order/aggregate,
entering a specific function at least twice with the same
link-query combination), and the code paths as they are now are
too complicated to understand without such testcases.
So what do we do? I think there are two possible approaches:
1. We take casual read at face value, in which case it is pretty
useless and should be disabled, deprecated and deleted as I
recommended above.
2. We redo the implementation of casual read, before coming back to
this ticket, which is a lot more work.
I still think 1 is much better, as spider code is too legacy and
complex and we should delete code whenever possible, and there does
not seem to be a usecase afaik for adding extra background threads
for each link when there's already one.
[1] https://github.com/MariaDB/server/commit/fe5ca4a3f58
[2] https://github.com/MariaDB/server/commit/5d45e7a0bd6
[3] https://github.com/MariaDB/server/commit/a7921996536
Also holyfoot , feel free to chime in if you have thoughts about
this
Following up on discussions with valerii, let me wrap up this
ticket.
Basically, my understanding after testing and analysing the code is
that spider_casual_read does not have any positive impact on the
query performance.
Whenever the casual read value is used, a background thread has
already been created per partition. Whether the value is 0 or 1 or 23
does not matter.
Take the test spider/bg.direct_aggregate_part[1] for example. This
is an example of select count(*) from T where T is partitioned spider
table referring to two different servers. The original test has casual
read 0, and it already creates a background thread for each partition.
I tested it with spider_casual_read to 1, as well as 23[2]. Again it
confirms my understanding, i.e. the these nonzero casual read values,
when in effect, create an extra bg thread to run the query on. The
previously created bg thread for the same link/partition just stays
idle for the rest of the query. So no gains whatsoever.
For more detailed analysis, see my previous comments in this ticket.
Closing.
Yuchen Pei
added a comment - Following up on discussions with valerii , let me wrap up this
ticket.
Basically, my understanding after testing and analysing the code is
that spider_casual_read does not have any positive impact on the
query performance.
Whenever the casual read value is used, a background thread has
already been created per partition. Whether the value is 0 or 1 or 23
does not matter.
Take the test spider/bg.direct_aggregate_part [1] for example. This
is an example of select count(*) from T where T is partitioned spider
table referring to two different servers. The original test has casual
read 0, and it already creates a background thread for each partition.
I tested it with spider_casual_read to 1, as well as 23 [2] . Again it
confirms my understanding, i.e. the these nonzero casual read values,
when in effect, create an extra bg thread to run the query on. The
previously created bg thread for the same link/partition just stays
idle for the rest of the query. So no gains whatsoever.
[1] https://github.com/MariaDB/server/blob/11.2/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test
[2] https://github.com/MariaDB/server/commit/5f5a24eb53f
For more detailed analysis, see my previous comments in this ticket.
Closing.
Valerii Kravchuk
added a comment - Should I create a new MDEV/task to change KB ( https://mariadb.com/kb/en/spider-server-system-variables/#spider_casual_read ) according to the results presented in this MDEV? Current text there still seems misleading.
Yuchen Pei
added a comment - > Should I create a new MDEV/task to change KB
> ( https://mariadb.com/kb/en/spider-server-system-variables/#spider_casual_read )
> according to the results presented in this MDEV? Current text there
> still seems misleading.
That's fine by me.
People
Anne Strasser (Inactive)
Valerii Kravchuk
Votes:
0Vote for this issue
Watchers:
8Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1077.1000000238419,"ttfb":317.7000000476837,"pageVisibility":"visible","entityId":101247,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"06536013-38da-4ee0-a91e-42dcc06b460c","navigationType":0,"readyForUser":1179,"redirectCount":0,"resourceLoadedEnd":899.5,"resourceLoadedStart":323.2999999523163,"resourceTiming":[{"duration":91.30000007152557,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":323.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":323.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":414.60000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":92.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":323.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":323.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":416.10000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":278.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":323.7999999523163,"connectEnd":323.7999999523163,"connectStart":323.7999999523163,"domainLookupEnd":323.7999999523163,"domainLookupStart":323.7999999523163,"fetchStart":323.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":416.89999997615814,"responseEnd":602,"responseStart":446.60000002384186,"secureConnectionStart":323.7999999523163},{"duration":449.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":324,"connectEnd":324,"connectStart":324,"domainLookupEnd":324,"domainLookupStart":324,"fetchStart":324,"redirectEnd":0,"redirectStart":0,"requestStart":418.7000000476837,"responseEnd":773.7999999523163,"responseStart":450.89999997615814,"secureConnectionStart":324},{"duration":130.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":324.10000002384186,"connectEnd":324.10000002384186,"connectStart":324.10000002384186,"domainLookupEnd":324.10000002384186,"domainLookupStart":324.10000002384186,"fetchStart":324.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":421.39999997615814,"responseEnd":454.39999997615814,"responseStart":452.39999997615814,"secureConnectionStart":324.10000002384186},{"duration":129.80000007152557,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":324.2999999523163,"connectEnd":324.2999999523163,"connectStart":324.2999999523163,"domainLookupEnd":324.2999999523163,"domainLookupStart":324.2999999523163,"fetchStart":324.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":421.2999999523163,"responseEnd":454.10000002384186,"responseStart":451.89999997615814,"secureConnectionStart":324.2999999523163},{"duration":140.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":324.5,"connectEnd":324.5,"connectStart":324.5,"domainLookupEnd":324.5,"domainLookupStart":324.5,"fetchStart":324.5,"redirectEnd":0,"redirectStart":0,"requestStart":439.2000000476837,"responseEnd":464.89999997615814,"responseStart":461.7000000476837,"secureConnectionStart":324.5},{"duration":96.19999992847443,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":324.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":324.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":420.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":140.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":324.89999997615814,"connectEnd":324.89999997615814,"connectStart":324.89999997615814,"domainLookupEnd":324.89999997615814,"domainLookupStart":324.89999997615814,"fetchStart":324.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":439.5,"responseEnd":465.2999999523163,"responseStart":462.39999997615814,"secureConnectionStart":324.89999997615814},{"duration":109,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":325,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":325,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":434,"responseStart":0,"secureConnectionStart":0},{"duration":142.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":325.2000000476837,"connectEnd":325.2000000476837,"connectStart":325.2000000476837,"domainLookupEnd":325.2000000476837,"domainLookupStart":325.2000000476837,"fetchStart":325.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":439.60000002384186,"responseEnd":467.5,"responseStart":463.60000002384186,"secureConnectionStart":325.2000000476837},{"duration":408.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":332.2000000476837,"connectEnd":332.2000000476837,"connectStart":332.2000000476837,"domainLookupEnd":332.2000000476837,"domainLookupStart":332.2000000476837,"fetchStart":332.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":642.2999999523163,"responseEnd":740.6000000238419,"responseStart":732.1000000238419,"secureConnectionStart":332.2000000476837},{"duration":567.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":332.2000000476837,"connectEnd":332.2000000476837,"connectStart":332.2000000476837,"domainLookupEnd":332.2000000476837,"domainLookupStart":332.2000000476837,"fetchStart":332.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":886.2000000476837,"responseEnd":899.5,"responseStart":898.8999999761581,"secureConnectionStart":332.2000000476837},{"duration":179.10000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":744.8999999761581,"connectEnd":744.8999999761581,"connectStart":744.8999999761581,"domainLookupEnd":744.8999999761581,"domainLookupStart":744.8999999761581,"fetchStart":744.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":888.8999999761581,"responseEnd":924,"responseStart":922.2999999523163,"secureConnectionStart":744.8999999761581}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":96,"responseStart":317,"responseEnd":326,"domLoading":321,"domInteractive":1280,"domContentLoadedEventStart":1280,"domContentLoadedEventEnd":1347,"domComplete":2868,"loadEventStart":2868,"loadEventEnd":2869,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1223.2999999523163},{"name":"bigPipe.sidebar-id.end","time":1224.2000000476837},{"name":"bigPipe.activity-panel-pipe-id.start","time":1224.2999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":1228.5},{"name":"activityTabFullyLoaded","time":1366}],"measures":[],"correlationId":"a5d5ff90a3d083","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":123,"dbReadsTimeInMs":19,"dbConnsTimeInMs":28,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The word "a connection channel" refers to a database connection to a data node (the Spider SE may have multiple channels to a single data node). With more partitions on a Spider table, you would have more chances to leverage parallelism. As the documentation said, this is true even if multiple shards are stored on the same physical server. Please note that it quite depends on how much the response time is reduced by parallel search, so it is best to have the actual measurement done in the user's environment.
Setting spider_casual_read=X (X in [2, 3..., 63]) is to let the Spider storage engine use the specific channel of No. X to each data node. This setting seems to be for fine-tuning and sometimes results in an excessive tweak. So, if one wants to benefit from a parallel read, I recommend setting spider_casual_read = 1 in most cases.