Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Netty Server communicating with android client - chat app

 
Kody Wright
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys!

Quick question. I'm in the process of developing a java server/android client app. The server is nearly complete...it works using a thread-per-client approach. However this will not scale very well when dealing with many clients connecting at once. This lead me to research some server-side solutions. I came across Netty, as it seems to be what I'm looking for as far as the scalability issue is concerned. Before I get too far into finishing the server I'd like to get the core down and not have to go back later to re-design it after the fact.

Netty used to not be compatible with Android, but apparently since 3.3(ish) it has been. It is now at 4.0, however I couldn't really find any resources for learning how to implement it for an android client/ java server combo. Does anyone here have any experience in this area? If not, are there any resources that are out there which could help me to better understand and use Netty for this purpose?

Thanks for your time!
 
Maneesh Godbole
Saloon Keeper
Posts: 11329
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you plan to use Google App Engine you can evaluate Google Cloud Endpoints (admittedly this is a "preview release")
Else how about plain old servlets with JSON?
 
Kody Wright
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had no idea about the Google App engine/Endpoints...that's really cool stuff. Perhaps I should approach the design from the android side first then figure exactly what the server needs to do.

Just FYI, I have a very rudimentary java client that I'm using to communicate/test the server with, so I have a rough idea of what the android app needs to do. When you talk about the plain servlets/JSON, would this get rid of the thread-per-connection issue? The system I'm developing will be responsible for maintaining mass connections (hundreds per server) in the same chat session.

So far it seems that the only way to avoid this is to either have the chat read/write into an SQL database (which seems like it would be ineffecient and slow) or implement some java NIO server functions (which apparently don't work well with the Android API).
 
Maneesh Godbole
Saloon Keeper
Posts: 11329
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kody Wright wrote:The system I'm developing will be responsible for maintaining mass connections (hundreds per server) in the same chat session.

That somehow doesn't sound right. 100s of connections per chat client? Maybe if you tell us what you are trying to do here, we can offer some suggestions.
 
Kody Wright
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:
Kody Wright wrote:The system I'm developing will be responsible for maintaining mass connections (hundreds per server) in the same chat session.

That somehow doesn't sound right. 100s of connections per chat client? Maybe if you tell us what you are trying to do here, we can offer some suggestions.


Sure thing.

The overall idea is to develop a chat system where many users (say a hundred or so) are interacting in the same chat session simultaneously. So it would be like a group chat, just bigger.

I know that similar systems already exist, just perhaps not for a mobile environment...which is what I would like to do. This is why an efficient server is so important. It's not 100s of connections per client, but a hundred or so clients being connected to one chat box (server).
 
Maneesh Godbole
Saloon Keeper
Posts: 11329
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah! Now I understand.
100s/1000s might have logged in to the group chat, but how many are posting at the same time? Hardly a few.
You will just need to notify all other 999 clients that client 1 said "Howdy" Check out Google cloud messaging
 
Kody Wright
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's exactly what I needed, you've really helped me out. Thanks a lot!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic