Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I hoped I wouldn't have to deal with that, but it seems like you can't avoid the inevitable.
I have in my server a pile of messages (received from the low-tier clients, and the upper-tier server), and are supposed to be broadcast eventually to all the clients, and to the server (simple tree hierarchy).
I'm not really familiar with the performance capabilities of C# sockets, or of my system in general.
I really have no idea how would my design deal under real-time conditions (I'm not talking about a supercomputer, just an ordinary server, sometimes even an ordinary computer...).
Anyway, I don't know if the distribution time would be sufficient to deal with all the incoming messages, treat them, and then distribute them to the others.

I started to think about scheduling strategies, all must deal with several stuff:
A. If there was a disconnection from a client, when he reconnects, he needs to be updated about the relevant changes.
B. There are messages that are more important (they are prioritized), but then if I let only them pass (first), they could very easily starve the lower priorities.

Maybe simple round-robin scheduling would do, or distribute by message to all the clients that didn't get it yet.

What do you guys think?
Posted

1 solution

Sending messages from servers to clients is not recommended as the clients could be offline and it would take up to much resources on the server and wouldn't scale.

Polling from the clients is recommended.

For the distribution of messages (depending on your requirements of low latency and low priority) you can look into RSS feeds.

Prioritizing messages is as simple as putting a priority value on them and sorting on that.
 
Share this answer
 
Comments
ShacharK 26-Oct-11 2:02am    
My service is actually server replication, but with some logic applied to the whole business. I want all my system's database to contain the same data (so I could, technically be working offline, and then when a connection is available, update everything... that while assuming that the connection would be available most of the time...).

I didn't say that prioritizing message is not simple, but it would require a scheduler algorithm, like in a process scheduler algorithm of every OS.

You think that I would benefit from sending my messages to the server, and then the server would "broadcast" them using RSS to all of his clients? Could you give me some more information on that? How can it be applied? and a big part of my tree hierarchy is in the LAN (if it matters...)
Mehdi Gholam 26-Oct-11 2:05am    
Look into MS Sync framework
ShacharK 26-Oct-11 2:27am    
I'm actually not interested in using it, Not for now, I'm trying to implement my own logic. Could you please shed light on the RSS method please?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900