In my GAE server the Datastore Read Operation is reaching to 100% after 12 hrs and I have about 20 users.
Along with other operations in my app I built a chat in which users that is connected to my app is pooling the server every 1 sec. Therefore I have a lot of request to /message
but I'm not accessing the datastore.
Is there a correlation between the number of requests to /message
(about 42K) with the maximum Datstore Read Operation (50k) ?
Edited:
code of /message
:
ArrayListMultimap<String, ChatMessage> messages;
ServletContext application = null;
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
if (application == null)
{
application = getServletContext();
messages = ArrayListMultimap.create();
}
out = response.getOutputStream();
oos = new ObjectOutputStream(out);
Object o = ServerUtils.readObject(request);
if(o instanceof ChatMessage)
{
ChatMessage message = (ChatMessage) o;
messages.put(message.getReciverId(), message);
List<ChatMessage> list = (List<ChatMessage>) messages.get(message.getReciverId());
}
else if(o instanceof String)
{
String sender = (String) o;
List<ChatMessage> list = (List<ChatMessage>) messages.removeAll(sender);
ArrayList<ChatMessage> newList = new ArrayList<ChatMessage>(list);
reponseToClient(newList);
}
}