Reducing Lag When Making Storage Service Calls

0 votes

Hi there. 

So, I've been experiencing some lag while sending Storage Service requests to your servers and I'm trying to avoid Application.Quit, Application.Pause, etc. due to unreliability.  This means I have to save data after every death in my game which causes considerable lag (about 3-5 seconds).

Here are the functions:


public IEnumerator UpdateAchievements (string DatabaseName, string CollectionName, string Key, string Value, string JSON, System.Action<App42StorageServiceCB> result)
            //Create new class.
            App42StorageServiceCB ASSCB = new App42StorageServiceCB();
            //Send new user call.
                Statics.StorageService.UpdateDocumentByKeyValue(DatabaseName, CollectionName, Key, Value, JSON, ASSCB);
            catch (App42Exception exception)
               //Debug.Log("Registration exception.");
                ASSCB.Error = exception;
                ASSCB.Failure = true;
            //Wait for the process to finish. 
            while (!ASSCB.Success && !ASSCB.Failure) yield return null;
            //Return the result. 

            Debug.Log("Update achievements.");

Then the above function is called with this:

public IEnumerator UpdateAchievementsCR (string Key, string Value, string CollectionName, string JSON, System.Action<App42StorageServiceCB> result)
            //This expression gets the user rank.
            App42StorageServiceCB Result = new App42StorageServiceCB();
            yield return StartCoroutine(Storage.UpdateAchievements(DatabaseName,
                                                                   value => Result = value));
            //if (Result.Success)//Debug.Log("Retrieved achievements.");
            //else if (Result.Failure)//Debug.Log(Result.Error);


I've narrowed down the offending function to UpdateDocumentByKeyValue.  Is the lag a normal occurrence when sending and retrieving data to the server?  

On a side note, InsertJSONDocument causes almost zero lag which makes me think it might be possible to update via DocID, so I'll try that as well.

Thanks in advance for all of your help.


asked Jul 14, 2017 in Android by null (23 points)

UpdateDocumentByDocId didn't improve performance.

InsertJSONDocument does actually cause lag.

1 Answer

0 votes

Could you please share the JSON you ae trying to insert and getting 3-5 seconds of lag? You can share it at .

It will help us to understand the problem.

answered Jul 17, 2017 by rajeev.etc (1,660 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on