Skip to content

Conversation

@singsangssong
Copy link
Collaborator

@singsangssong singsangssong commented Oct 13, 2025

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

Spymemcached์™€์˜ ํ˜ธํ™˜์„ฑ์„ ๋งž์ถ”๊ธฐ ์œ„ํ•ด Future ๊ฐ์ฒด์— ๋ฆฌ์Šค๋„ˆ(listener)๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด์ œ .addListener()๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ž‘์—… ์™„๋ฃŒ ํ›„ ์‹คํ–‰๋  ๋กœ์ง์„ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

spymemcached์—์„œ๋Š” GetFuture ํด๋ž˜์Šค๊ฐ€

  • AbstractListenableFuture ํด๋ž˜์Šค ์ถ”๊ฐ€
    • ReentrantLock์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฆฌ์Šค๋„ˆ ๋ชฉ๋ก ์ ‘๊ทผ ์‹œ์˜ ์•ˆ์ •์„ฑ์„ ํ™•๋ณดํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ExecutorService๋ฅผ ํ†ตํ•œ ๋ฆฌ์Šค๋„ˆ ์‹คํ–‰
    • I/O ์Šค๋ ˆ๋“œ๋ฅผ ๋ฐฉํ•ดํ•˜์ง€ ์•Š๋„๋ก, ๋ณ„๋„์˜ ์Šค๋ ˆ๋“œ ํ’€์—์„œ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์‹คํ–‰ํ•˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๊ธฐ์กด Future ํด๋ž˜์Šค ๊ตฌ์กฐ ๋ณ€๊ฒฝ
    • OperationFuture, BulkGetFutureํด๋ž˜์Šค๋Š”AbstractListenableFuture๋ฅผ ์ƒ์†๋ฐ›์•„ ๋ฆฌ์Šค๋„ˆ ๊ธฐ๋Šฅ์„ ๊ฐ–๋„๋ก ๊ตฌ์กฐ๋ฅผ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.
    • GetFuture์˜ ๊ฒฝ์šฐ, Spymemcached์™€ ๋‹ฌ๋ฆฌ Arcus์˜ ๊ธฐ์กด ๊ตฌ์กฐ์ธ GetFuture extends OperationFuture๋ฅผ ์œ ์ง€ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด GetFuture๋Š” OperationFuture๋กœ๋ถ€ํ„ฐ ๋ฆฌ์Šค๋„ˆ ๊ธฐ๋Šฅ์„ ์ž๋™์œผ๋กœ ์ƒ์†๋ฐ›์œผ๋ฉฐ, ์ž์‹ ์€ GetResult ๊ฐ์ฒด๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ์Šต๋‹ˆ
  • MemcachedClient ์ˆ˜์ •
    • asyncGet, asyncGets, asyncStore ๋“ฑ OperationFuture๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ชจ๋“  ๋ฉ”์†Œ๋“œ์—์„œ ExecutorService๋ฅผ ์ฃผ์ž…ํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • ํ˜„์žฌ ํ…Œ์ŠคํŠธ์ฝ”๋“œ๋Š” ๋”ฐ๋กœ ๊ตฌํ˜„๋˜์ง€ ์•Š์€ ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ํ…Œ์ŠคํŠธ์ฝ”๋“œ๊ฐ€ ํ•„์š”ํ•˜๋‹ค๋ฉด ์ถ”๊ฐ€ํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

@uhm0311
Copy link
Collaborator

uhm0311 commented Oct 14, 2025

Generic ์‚ฌ์šฉ์ด ๊ณผํ•˜๋‹ค๋Š” ๋А๋‚Œ์ด ์žˆ๋Š”๋ฐ, spymemcached์— ๋งž์ถ”์–ด์•ผ ํ•˜๋Š” ๊ฑด๊ฐ€์š”?

@singsangssong
Copy link
Collaborator Author

์ผ๋‹จ ๊ตฌํ˜„์€ spymemcached๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋งž์ท„์Šต๋‹ˆ๋‹ค.
spymemcached ๊ตฌํ˜„์—์„œ๋Š” ํƒ€์ž… ์•ˆ์ •์„ฑ์„ ๊ณ ๋ คํ•˜์ง€ ์•Š์€ ์ฝ”๋“œ๊ฐ€ ๋ช‡๋ช‡ ์žˆ์—ˆ๊ณ , ์ด๊ฒƒ์ด warning ์—๋Ÿฌ๋ฅผ ๋ฐœ์ƒ์‹œ์ผœ ci๊ฐ€ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋•Œ๋ฌธ์— ํƒ€์ž…์•ˆ์ •์„ฑ์„ ํ™•๋ณดํ•˜๊ณ  ci๋ฅผ ์„ฑ๊ณต์‹œํ‚ค๊ณ ์ž ์ œ๋„ค๋ฆญ์ด ๋งŽ์•„์กŒ์Šต๋‹ˆ๋‹ค.

@oliviarla
Copy link
Collaborator

@singsangssong
spymemcached์™€ ๊ตฌํ˜„ ์ƒ ๋‹ค๋ฅธ์ ์ด ์žˆ๋‹ค๋ฉด ์™œ ๋‹ค๋ฅด๊ฒŒ ๊ตฌํ˜„ํ–ˆ๋Š”์ง€์— ๋Œ€ํ•œ ์„ค๋ช…์„ ์ฒซ ์ฝ”๋ฉ˜ํŠธ์— ์ถ”๊ฐ€ํ•ด์ฃผ์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

@singsangssong
Copy link
Collaborator Author

๊ตฌํ˜„์ƒ ๋‹ค๋ฅธ์ ์€ ์ฒซ ์ฝ”๋ฉ˜ํŠธ์— ๋ณผ๋“œ์ฒด๋กœ ํ‘œ์‹œํ•ด๋‘์—ˆ์Šต๋‹ˆ๋‹ค.

uhm0311

This comment was marked as resolved.

uhm0311

This comment was marked as resolved.

@singsangssong singsangssong force-pushed the task/listener branch 3 times, most recently from 6db8484 to 19949cb Compare October 15, 2025 09:38
uhm0311

This comment was marked as resolved.

uhm0311

This comment was marked as duplicate.

uhm0311
uhm0311 previously approved these changes Oct 16, 2025
oliviarla

This comment was marked as resolved.

@singsangssong singsangssong force-pushed the task/listener branch 3 times, most recently from 41636a9 to 5e01f62 Compare October 17, 2025 07:20
@singsangssong
Copy link
Collaborator Author

๊ฐ„๋‹จํ•˜๊ฒŒ ํ…Œ์ŠคํŠธ์ฝ”๋“œ๊นŒ์ง€ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ๋ฆฌ์Šค๋„ˆ๋ฅผ ํ…Œ์ŠคํŠธํ•  ๊ณณ์ด ๋งˆ๋•…ํ•˜์ง€ ์•Š์•„์„œ test/java/net/spy/memcached์— FutureListenerTestํด๋ž˜์Šค์— ์ž‘์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค.

uhm0311
uhm0311 previously approved these changes Oct 21, 2025
Copy link
Collaborator

@oliviarla oliviarla left a comment

Choose a reason for hiding this comment

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

  • (@singsangssong) ConnectionFactoryBuilder ์—๋„ ExecutorService ์„ค์ •ํ•˜๋Š” ๊ธฐ๋Šฅ์ด ์žˆ์œผ๋‹ˆ ํ•จ๊ป˜ ์ถ”๊ฐ€๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  • (@uhm0311 @jhpark816) ์ง€๊ธˆ Listener ํด๋ž˜์Šค๋ฅผ ํ•˜๋‚˜๋งŒ ๋‘๊ณ  ์žˆ์–ด์„œ ์‹ค์ œ spymemcached์— ์กด์žฌํ•˜๋Š” BulkGetCompletionListener, GetCompletionListener ๋ฅผ ์ƒ์„ฑํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ arcus java client์—๋Š” ํ•ด๋‹น ํด๋ž˜์Šค๊ฐ€ ์—†์œผ๋ฏ€๋กœ ๋ฐ”๋กœ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ €๋Š” ์ด๋ถ€๋ถ„๋„ ์ตœ๋Œ€ํ•œ ํ˜ธํ™˜ํ•˜๋Š”๊ฒŒ ์ข‹๋‹ค๋Š” ์ž…์žฅ์ธ๋ฐ ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?

}
} else {
MemcachedConnection.opsSucceeded(ops);
signalComplete();
Copy link
Collaborator

Choose a reason for hiding this comment

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

์ด ๋ฉ”์„œ๋“œ๋ฅผ ์—ฌ๊ธฐ์„œ ํ˜ธ์ถœํ•  ํ•„์š” ์—†์Šต๋‹ˆ๋‹ค.

* on futures.
*/
ExecutorService getListenerExecutorService();

Copy link
Collaborator

Choose a reason for hiding this comment

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

boolean isDefaultExecutorService(); ๋„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

@oliviarla
Copy link
Collaborator

@singsangssong BulkGetCompletionListener, GetCompletionListener ํด๋ž˜์Šค๋„ spymemcached์™€ ๋™์ผํ•˜๊ฒŒ ์ถ”๊ฐ€ํ•ด์ฃผ์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

@singsangssong
Copy link
Collaborator Author

singsangssong commented Oct 30, 2025

์ด์ „ ๋ฆฌ๋ทฐ๋ฅผ ํ†ตํ•ด์„œ ์ œ๋„ค๋ฆญ์„ ์ œ๊ฑฐํ•œ ๊ตฌ์กฐ์ธ๋ฐ, ์ด๋ฅผ ๊ธฐ์กด spymemcached์ฒ˜๋Ÿผ ์ œ๋„ค๋ฆญ์„ ์ถ”๊ฐ€ํ•˜๋‚˜์š”?

์ง€๊ธˆ Listener ํด๋ž˜์Šค๋ฅผ ํ•˜๋‚˜๋งŒ ๋‘๊ณ  ์žˆ์–ด์„œ ์‹ค์ œ spymemcached์— ์กด์žฌํ•˜๋Š” BulkGetCompletionListener, GetCompletionListener ๋ฅผ ์ƒ์„ฑํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ arcus java client์—๋Š” ํ•ด๋‹น ํด๋ž˜์Šค๊ฐ€ ์—†์œผ๋ฏ€๋กœ ๋ฐ”๋กœ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

ํ•ด๋‹น ์ฝ”๋ฉ˜ํŠธ๋กœ๋Š” ๊ตฌํ˜„์„ ๊ธฐ์กด spymemcached์—์„œ ๊ฐ€์ ธ์˜ค๋Š” ๊ฒƒ์œผ๋กœ ์ดํ•ดํ–ˆ์Šต๋‹ˆ๋‹ค.
spymemcached์—์„œ๋Š” GetFuture์˜ ํ•„๋“œ๋กœ OperationFuture๋ฅผ ๊ฐ€์ง€๋ฉฐ, arcus๋Š” OperationFuture๋ฅผ ์ƒ์†๋ฐ›๊ณ  ํ•„๋“œ๋กœ GetResult๋ฅผ ํ•„๋“œ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์  ๋•Œ๋ฌธ์— ์ฒซ ์ปค๋ฐ‹์—์„œ๋Š” GetCompletionListener์—†์ดGetFuture๋ฅผ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

@oliviarla
Copy link
Collaborator

spymemcached ํ˜ธํ™˜์„ ๋งž์ถ”์ง€ ์•Š๊ธฐ๋กœ ๊ฒฐ์ •๋˜์–ด closeํ•ฉ๋‹ˆ๋‹ค.

@oliviarla oliviarla closed this Oct 30, 2025
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.

3 participants