Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL: use groupingKeys in asyncGet(s)Bulk #801

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

oliviarla
Copy link
Collaborator

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

addKeyToMap() ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜์ง€ ์•Š๊ณ ,
ํ˜ธ์ถœ ์ชฝ์—์„œ ํ•ด๋‹น ๋กœ์ง์„ ์ง์ ‘ ๊ฐ€์ง€๋Š” ๊ฒƒ์ด ์ข‹์„ ๊ฒƒ ๊ฐ™์€ ๋ฐ,
ํ™•์ธํ•˜๊ณ  ๋™์˜ํ•œ๋‹ค๋ฉด PR ๋ณด๋‚ด ์ฃผ์„ธ์š”.

  • asyncGetBulk, asyncGetsBulk์—์„œ ๋…ธ๋“œ์— ๋”ฐ๋ผ ํ‚ค๋ฅผ ๋ถ„๋ฐฐํ•  ๋•Œ groupingKeys ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.
  • ์ด๋ฅผ ํ†ตํ•ด ์ผ๊ด€์ ์ธ ๋‚ด๋ถ€ ๋™์ž‘์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • addKeyToMap, getWholeChunkSize ๋ฉ”์„œ๋“œ๋Š” ์ œ๊ฑฐํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Copy link
Collaborator

@jhpark816 jhpark816 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฆฌ๋ทฐ ์™„๋ฃŒ

Collection<String> keyList, int maxKeyCountPerGroup) {
List<Map.Entry<MemcachedNode, List<String>>> resultList = new ArrayList<>();
Map<MemcachedNode, List<String>> nodeMap = new HashMap<>();
MemcachedConnection conn = getMemcachedConnection();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MemcachedClient ํด๋ž˜์Šค๋กœ ์˜ฎ๊ฒผ์œผ๋ฏ€๋กœ, ์•„๋ž˜ ์ฝ”๋“œ๋Š” ์—†์–ด๋„ ๋ฉ๋‹ˆ๋‹ค.

MemcachedConnection conn = getMemcachedConnection();

op = opFact.mgets(keyList, cb);
} else {
op = node.enabledMGetsOp() ? opFact.mgets(keyList, cb)
: opFact.gets(keyList, cb);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•„๋ž˜์™€ ๊ฐ™์€ ์ฝ”๋“œ์ด๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

        op = node.enabledMGetsOp() ? opFact.mgets(keyList, cb)
                                   : opFact.gets(keyList, cb);

conn.addOperation(node, op);
ops.add(op);
Operation op;
if (node == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์—ฌ๊ธฐ๋Š” ์งˆ๋ฌธ์ž…๋‹ˆ๋‹ค.

node == null ์ƒํ™ฉ์—์„œ operation ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค์–ด connection์— ์ถ”๊ฐ€ํ•  ํ•„์š”๊ฐ€ ์žˆ๋‚˜์š”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ˜„์žฌ๋Š” connection์—์„œ node๊ฐ€ null์ผ ๊ฒฝ์šฐ op๋ฅผ cancel ์‹œํ‚ค๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
์—ฌ๋Ÿฌ ๋…ธ๋“œ์— ๋‹ค์–‘ํ•œ mget op๋ฅผ ๋ณด๋‚ด๋†“๊ณ  node๊ฐ€ null์ผ ๊ฒฝ์šฐ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด cancel๋กœ ์ธํ•ด ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ ๋•Œ๋ฌธ์—, get/mget ์š”์ฒญ์ด ์„œ๋ฒ„์—์„œ ์ฒ˜๋ฆฌ๋˜์—ˆ์ง€๋งŒ ๊ฒฐ๊ณผ๊ฐ’์„ ์–ป์„ ์ˆ˜ ์—†๋Š” ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ด๋ฅผ ๋ง‰์œผ๋ ค๋ฉด node๊ฐ€ null์ธ ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•  ๋•Œ ๊ธฐ์กด ops list์— ์กด์žฌํ•˜๋Š” ๋ชจ๋“  op๋ฅผ cancel์‹œํ‚ค๊ณ  ์ด op๋„ cancel์‹œํ‚ค๊ณ  ์˜ˆ์™ธ๋ฅผ ๋˜์ง€๋ฉด ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node๊ฐ€ null ์ด๋ผ๋Š” ์˜๋ฏธ๋Š” ํ˜„์žฌ ๋‚จ์•„ ์žˆ๋Š” node๊ฐ€ ์—†๋‹ค๋Š” ๊ฒƒ์ด๋ฏ€๋กœ,
๋ชจ๋“  key๋“ค์ด null node์— mapping ๋  ๊ฒƒ ๊ฐ™๊ณ , ์ƒ์„ฑํ•˜๋Š” ๋ชจ๋“  op๊ฐ€ ์ƒ์„ฑ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
๋งž์ง€ ์•Š๋Š” ๋ถ€๋ถ„์ด ์žˆ์œผ๋ฉด, ์•Œ๋ ค์ฃผ์„ธ์š”.

@jhpark816 jhpark816 merged commit c1c5592 into naver:develop Aug 29, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants