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

Batch: ✨ Batch Job For Write Back & Write Allocate Strategy (This is Last Piece πŸ€—) #194

Merged
merged 22 commits into from
Nov 7, 2024

Conversation

psychology50
Copy link
Member

μž‘μ—… 이유

  • To implement a batch process that synchronizes last read message status from Redis cache to database

μž‘μ—… 사항

  1. Created batch components:
  • Reader: Reads last message status data from Redis using cursor
  • Processor: Converts Redis key-value data to ChatMessageStatus entity
  • Writer: Saves processed data to database using bulk insert
  1. Added integration tests to verify:
  • Basic batch execution with test data
  • Handling of invalid/partial data
  • Empty data scenario
  • Large dataset processing
  1. Configured scheduler to run every 30 minutes using @Scheduled annotation

리뷰어가 μ€‘μ μ μœΌλ‘œ 확인해야 ν•˜λŠ” λΆ€λΆ„

  1. Batch Architecture:
  • Is the separation of concerns appropriate? (Reader/Processor/Writer)
  • Is the error handling sufficient?
  1. Data Integrity:
  • Will this implementation prevent data loss?
  1. Performance:
  • Is the Redis cursor implementation efficient?
  • Is the bulk insert strategy optimal?
  1. Test Coverage:
  • Are the test cases comprehensive enough?
  • Are there any missing edge cases?

λ°œκ²¬ν•œ 이슈

  1. Redis Scan Operation Non-Atomicity
    • Since Redis scan operations are non-atomic, there might be edge cases.
    • However, with the batch scheduler running every 30 minutes and Redis cache TTL set to 1 hour, this timing should prevent issues.
  2. Bulk Insert Operation Load Concerns
    • Bulk inserts could cause temporary database load spikes. Adjusting the chunk size may help manage this if needed.
  3. Post-Sync Redis Data Persistence
    • The current implementation keeps Redis data after synchronization.
    • We might consider adding a cleanup function in the future.
  4. MySQL Batch Insert Refactoring
    • The current MySQL batch insert isn’t functioning as a true batch insert. Refactoring is needed to address this.

@psychology50 psychology50 added the enhancement New feature or request label Nov 7, 2024
@psychology50 psychology50 self-assigned this Nov 7, 2024
@psychology50 psychology50 merged commit 14ca265 into dev Nov 7, 2024
1 check passed
@psychology50 psychology50 deleted the feat/last-message-id-save-batch branch November 7, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant