Recently I’ve been working with several apps from the same client that all rely on regular posts to their web server to post various data objects from their app. Under a minimal load these network operations work properly where the app sends a data post and waits for a response back.

Just recently the app was put under less than minimal conditions however and the app came to a halt. Due to circumstances beyond their control the wifi and cell network they were using at an event with over 3000 users began to cripple. Since their app relied on immediate responses from the server the app got stuck waiting sometimes minutes for a response that usually took milliseconds.

Our solution was twofold:

First we created a local in-app cache of the data the app needed from the server. Even though the server data is regularly updated it was a good enough compromise in their setting to update the local copy on an hourly basis.

Second we implanted the freezable operation concept from MKNetworkKit. Even though we had a local copy of the data we still needed to send the user actions to the server for processing. So our lookups happen locally but the server still needed to know the action taken with the data.

With freezable operations we could immediately process the action locally and queue the operation without needing a server response. If the network is operational the post to the server happens quickly although decoupled from the lookup now. That alone sped up the app. But the real improvement came with the freezable operation during an offline situation. We queued the operation as usual and just kept on going with more local data actions. Whenever the network comes back online the frozen operations are automatically processed by MKNetworkKit. The server gets the action data and all is well but with. I performance degradation.

Definitely a vast improvement to the app