Feedback on fetch_stock.json Requests After Bulk Operation

Solved

Feedback on fetch_stock.json Requests After Bulk Operation

GuestUser69
Shopify Partner
12 2 1

We run an app and intend to make prolific use of bulk operations. The app creates fulfillment services and has stock updates enabled.

 

Recently, we ran a bulk operation on about 15,000 products. This generated quite a bit of activity over the next 8 hours. Some of that activity resulted in service degradation.

 

utilization-00.JPG

Spike in log records after starting bulk operation.

 

utilization-01.JPG

Spike in database load coinciding with increased log activity.

 

It seems that for every product that is updated, there is one fetch_stock.json request. If you consider that the responses to fetch_stock.json requests will accept the inventory levels for multiple SKUs, then this seems a bit excessive.

 

utilization-02.jpg

Optimized query and reran bulk operation to confirm issue and measure impact. Returned empty responses after confirming issue.

 

A couple of lessons here:

  • If you plan on doing something similar, then be prepared to accommodate the responses from Shopify. 
  • If Shopify requests stock, then you should not respond with live inventory levels.
  • If your fulfillment service is opted into stock updates, then consider caching the inventory levels.
  • If you're subscribed to webhooks, then you should have a similar strategy for accommodating the flood of activity.
Accepted Solution (1)

GuestUser69
Shopify Partner
12 2 1

This is an accepted solution.

Some final thoughts about this:

 

After implementing a queueing and caching strategy for the flood of activity, there's still 15,000x more requests being made than is sensible. It still doesn't make sense to make one fetch_stock.json request for every product updated in a bulk operation. It's still a waste of bandwidth and poor use of network traffic.

 

Reminder:

If you're doing bulk product operations on thousands of products, be prepared to deal with the feedback from Shopify. It sends just as many requests back to your fulfillment service.

View solution in original post

Reply 1 (1)

GuestUser69
Shopify Partner
12 2 1

This is an accepted solution.

Some final thoughts about this:

 

After implementing a queueing and caching strategy for the flood of activity, there's still 15,000x more requests being made than is sensible. It still doesn't make sense to make one fetch_stock.json request for every product updated in a bulk operation. It's still a waste of bandwidth and poor use of network traffic.

 

Reminder:

If you're doing bulk product operations on thousands of products, be prepared to deal with the feedback from Shopify. It sends just as many requests back to your fulfillment service.