In the logistics and eCommerce industry, accurate package weight measurement is critical for fair billing and dispute resolution. Shiprocket, India’s leading commerce enablement platform, serves thousands of sellers and facilitates seamless shipping operations. However, weight disputes between sellers and courier partners often arise due to discrepancies in recorded weights, leading to financial losses, delays, and operational inefficiencies. These disputes require concrete evidence, such as weight images, to facilitate resolution.
The traditional method of handling weight disputes has always been time-consuming and inefficient. Manual verification of shipment weight led to bottlenecks, making it difficult for Shiprocket’s dispute resolution team to efficiently handle large volumes of requests. With eCommerce growing rapidly, the need for a scalable and automated solution became urgent. Shiprocket’s platform aims to provide a transparent and seamless shipping experience, ensuring that sellers are charged accurately for their shipments.
Previously, the system faced severe limitations in processing bulk image uploads, leading to delays in dispute resolution. Processing 1,000 requests took approximately 46 minutes, making it impractical to handle millions of requests per month efficiently.
Shiprocket’s Solution for Narrowing Weight Discrepancies
To address this challenge, a highly scalable solution using AWS Lambda was developed. This approach enabled efficient processing of millions of requests per month by leveraging a serverless architecture and breaking down large tasks into smaller, manageable units.
Serverless Approach
Shiprocket adopted a serverless architecture to eliminate the need for managing traditional servers, ensuring automatic scaling and cost efficiency. AWS Lambda allows functions to run in response to events without requiring dedicated infrastructure, reducing operational overhead and improving responsiveness. This architecture enables rapid execution, minimal maintenance, and seamless integration with AWS services such as S3 and CloudWatch.
Implementing our strategic approach
Workflow Diagram
Below is a workflow diagram illustrating the AWS Lambda implementation for courier image processing:
- 🗂 S3 Event Trigger – Initiates when a CSV file is uploaded to a specific S3 bucket folder.
- 🛠 AWS Lambda Execution – Handles the processing asynchronously to ensure scalability.
- 📥 Extract S3 Object – Reads the CSV file from S3.
- 📊 Read and Parse CSV File – Extracts AWB numbers and image URLs.
- 🌐 Download Image from URL – Fetches the image from the external source.
- 📤 Save Image to S3 – Uploads the processed images to an S3 bucket.
- 📝 Create Response CSV – Generates a CSV file containing success, failure, and invalid URL statuses.
- 🔄 Call API – Sends the processed image data to the core system.
- 🏦 Update Database – Updates the database with processed image links
Input File Format
The Logistics Operations (LOPS) team prepares CSV files containing 10,000 rows, with each row consisting of:
- AWB Number
- External Image Link
Batch Processing
The CSV files are divided into smaller batches of 100 rows each. This modular approach ensures that processing remains manageable and efficient, even for large datasets.
AWS S3 as Trigger
- The smaller batch files are uploaded to an S3 bucket.
- A PUT-Object event in S3 acts as a trigger, invoking a Lambda function for each batch.
- For every 10,000 records, 100 Lambda functions are triggered in parallel, ensuring rapid processing.
Lambda Function Workflow
Each Lambda function:
- Reads the batch of 100 records from the uploaded CSV file.
- Downloads the images from the external links.
- Uploads the images to an S3 bucket.
- Generates a response file containing the status of each record (e.g., success, failure, or invalid URL).
Database Update
After completing the image processing, the Lambda function sends a CURL request to the core system.
- This request updates the database with the image links corresponding to the AWB numbers.
Key Benefits Of Using AWS Lambda
Massive Reduction in Processing Time
- Old Process: ~46 minutes for 1,000 requests.
- New Process: ~2 minutes for 10,000 requests.
Performance Metrics
The new system’s latest processing data showcases its efficiency:
Total Count | Error | Success | Upload Time | Response Time | Duration (seconds) |
---|---|---|---|---|---|
8822 | 25 | 8797 | 2024-05-22 16:39:28 | 2024-05-22 16:40:04 | 36 |
9999 | 7 | 9992 | 2024-05-22 16:38:10 | 2024-05-22 16:38:49 | 39 |
7960 | 18 | 7942 | 2024-05-21 18:03:47 | 2024-05-21 18:04:28 | 41 |
9948 | 23 | 9925 | 2024-05-17 23:08:15 | 2024-05-17 23:10:14 | 119 |
9968 | 22 | 9946 | 2024-05-17 23:05:32 | 2024-05-17 23:03:55 | 122 |
Scalability
- The system can now handle millions of requests per month without performance degradation.
Cost Efficiency
- AWS Lambda’s pay-as-you-go model ensures costs remain proportional to usage.
Improved Accuracy and Transparency
- Automated weight verification minimizes human errors and ensures reliable data.
- Dispute resolutions are now faster, reducing unnecessary back-and-forth between sellers and logistics partners.
- Real-time monitoring allows quick identification and rectification of discrepancies.
Shiprocket’s Next Step for Resolving Weight Discrepancies
- Error Handling Improvements
- Implement more robust mechanisms to handle invalid URLs or failed uploads.
- Monitoring and Reporting
- Use AWS CloudWatch and dashboards for real-time monitoring and reporting of upload statuses.
- Support for Larger Files
- Enhance the solution to support CSV files with more than 10,000 rows if required.
- AI-Powered Image Verification
- Implement AI-driven image analysis to detect weight discrepancies automatically.
- Use machine learning models to predict possible disputes before sellers raise concerns.
Conclusion
By utilising AWS Lambda, S3 triggers, and parallel processing, the courier image upload process has been transformed into a scalable, efficient, and highly performant solution. The serverless approach ensures automatic scaling, reduced operational overhead, and cost efficiency while handling millions of requests per month. This system is now well-equipped to meet the growing demands of Shiprocket’s logistics operations, ensuring faster turnarounds and improved operational efficiency for the LOPS team.
Shiprocket continues to innovate in the logistics space, prioritising seller experience and operational efficiency. By leveraging serverless technology, Shiprocket ensures transparency, fairness, and reliability in eCommerce logistics, further cementing its position as a trusted shipping partner for thousands of businesses across India.