Deleting messages a...
 
Notifications
Clear all

Deleting messages and maybe mysql slow response?

6 Posts
2 Users
0 Likes
629 Views
 Bob
(@lepif)
Posts: 3
Active Member
Topic starter
 

Hello! .. i'm using the messaging system, creating a small messagebox with auto-deleting messages, it means that i load the messages with messageLoad(), put them into arrays, saving them into different xml so any message has his own small xml file,as soon as i saved the message, i want the message in the database to be deleted, so i call the delete().

Everything works perfect until i load too many messages at once, i did some test, and until messages are like 56 or less, perfect; if there are more, it gives me sometimes the delete failed.. i don't know why this happens.

My only idea is that i call the delete() too quickly from one another and mysql is a bit slow, can it be? (the delete failed string error always return blank) .. any other idea?

 

thanks!

 
Posted : 08/01/2016 3:55 pm
(@skaredcreations)
Posts: 804
Prominent Member Admin
 

Of course if you make many calls in few time from each client, your server performance will be severely affected. You should be wise to spread calls over time and possibly design your code logic to not make too many calls at same/few time.

A workaround in your case could be to manage the delete in a coroutine after you load the messages in the array:

void LoadMessages ()
{
   Combu.Mail.Load(Combu.eMailList.Received, 1, 10, (Combu.Mail[] messages, int recordsCount, int pagesCount, string error) => {
      StartCoroutine(DeleteMessages(messages));
   });
}
IEnumerator DeleteMessages (Combu.Mail[] messages)
{
   foreach (var message in messages)
   {
      bool deleted = false;
      message.Delete((bool success, string error) => {
         deleted = true;
      });
      while (!deleted)
         yield return null;
   }
}

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 08/01/2016 4:17 pm
 Bob
(@lepif)
Posts: 3
Active Member
Topic starter
 

Thanks a lot, gonna try this and let you know 🙂

I have a couple of info more to ask, i haven't found them in the manual:

-- is the message id (long) going incremental forever or it can be resettedchanged with a random unique string (random.org like)?

-- how many user do you think (based on a high mysql performance, using aruba at the moment) your platform can handle simultaneously (logged in)? i'll be using it for messages and user info only at the moment

thanks again, very good product!

 
Posted : 09/01/2016 1:25 pm
(@skaredcreations)
Posts: 804
Prominent Member Admin
 

All Id field of every table is BIGINT autoincrement, you can read more on MySql documentation about that.

About users, since HTTP is an asynchronous protocol there's no live connection, all depends on the number of calls and how you handle that. That is why you're having issues doing many calls at same time, it affects your server responsiveness, so a good design of calls to API ahead is a good start.

For example you cannot think to use Combu for realtime networking, but you would use it to store your player's stats and integrate with other third-party like Photon.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 09/01/2016 1:32 pm
 Bob
(@lepif)
Posts: 3
Active Member
Topic starter
 

..thanks for the code suggestion,works good, didn't think of that 🙂

yes, absolutely about http being asynchronous, i just wanted to do a very (very) tiny whatsapp, redesign the calls much more like  loginget messagessavedeletelogout; About the login question,since is based on wordpress, i made some research, and the possible simultaneously users online number is pretty high, so don't need to worry about that i guess; Just one more thing, i'd like to integrate some push notifications for mobile, i'm studying them right now, do you think i can manage a message notifications through the push?

thanks for all the answers, done bothering 🙂

 
Posted : 10/01/2016 1:38 pm
(@skaredcreations)
Posts: 804
Prominent Member Admin
 

Yes, I suppose you can do an application like that, as said you only need to a good design ahead for the call to webservices. Tricks like the code snippet above or a similar methods to manage a queue of calls is a good way to spread the the work load and avoid hurt the server performance.

I never worked on push notification, but I suppose they're just like a function in your code that is called upon time (or is alive, I don't know) so I suppose you can do anything with it, Combu client code is just using the Unity built-in class WWW. You just need to handle the errors in your callbacks (for the case when there's no internet connection, for example).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 10/01/2016 5:11 pm
Share: