Govind
Govind

Reputation: 111

Concurrency in Google app engine

I have a chat application in google app engine. I am facing the concurrency issues. When the chat starts from one end, that chat will broadcast to all available agents in the account. When 1 guy responds that guy will take ownership and remove all the remaining guys in that session.

Here i am facing problem with concurrent requests from more than 1 agent response at the same time. At this point each request takes out the remaining agents in the session and no body is there in the session.

I thought this solves with code synchronization. But with multiple instances doesn't work this logic. Since the code is in different servers.

Is there a way to acheive this make synchronize using datastore/memcache.

Please suggest on this.

Thanks in advance.

Govind.

Upvotes: 0

Views: 755

Answers (2)

Govind
Govind

Reputation: 111

I tried this using Transactions. But some reason it wont work out to me. I dont know the reason. But with Memcache increment/decrement we can solve the problem. These methods are atomic. This is simple and optimistic.

Please go through this group

https://groups.google.com/forum/#!topic/google-appengine-java/wtESRwKCF5U

Thanks for your updates.

Govind.

Upvotes: 0

Tim Hoffman
Tim Hoffman

Reputation: 12986

Look at using CAS with memcache, alternately you can use transactions in the datastore and plan control entities with known keys. I don't use java so can't whip up an example , and I can only find api docs for java on cas

https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/memcache/MemcacheService.CasValues

but the writeup in python would still explain what is going on .

https://developers.google.com/appengine/docs/python/memcache/#Python_Using_compare_and_set_in_Python

Upvotes: 1

Related Questions