Redesigning the Artemis account deletion back-end
Summary
The Artemis service has redesigned its account deletion backend to address scalability issues and prevent request timeouts. Initially, all deletion steps were synchronous, causing problems as user data grew, particularly for users with hundreds of feeds and posts. The new flow now checks the number of posts associated with an account upon deletion request. If fewer than 1,000 posts exist, deletion occurs immediately. For accounts with more than 1,000 posts, a flag is set, the user is signed out, and a cron job handles the deletion asynchronously every hour. This asynchronous approach ensures that even lengthy deletions for older accounts with substantial data complete without timing out, and users receive an email confirmation upon completion. The service also plans to implement asynchronous account data export for similar reasons.
Key takeaway
For Software Engineers managing user data in growing services, migrating from synchronous to asynchronous account deletion is crucial. Your current synchronous process will eventually lead to request timeouts and a poor user experience as data volumes increase. Implement a threshold-based system to handle small deletions immediately while offloading larger deletions to background jobs, ensuring reliability and reducing support burden.
Key insights
Asynchronous processing prevents timeouts and improves user experience for data-intensive operations.
Principles
- Synchronous operations scale poorly with data volume.
- Thresholds can gate synchronous vs. asynchronous processing.
Method
Implement a conditional deletion flow: immediate for small data sets (<1,000 posts), and scheduled asynchronous processing via a cron job for larger sets, followed by email notification.
In practice
- Use cron jobs for background data processing.
- Implement a post-deletion email notification.
- Consider data export for asynchronous processing.
Topics
- Account Deletion Flow
- Asynchronous Processing
- Backend Redesign
- Cron Jobs
- Data Management
Best for: Software Engineer, Data Engineer, DevOps Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by James' Coffee Blog.