Android

lessons learned after developing a server

tomato13 2013. 9. 6. 13:22

I was involved in a server development if a photo application. I listed my learning below. (As next week, I move to another job)

 

1.A server should always wait for any client message. In other words, this task should be operating as an independent thread task.


2. The server should consider that there may be no response from any client.


3. A server's database is core asset in its operation. You should design it well from the beginning.


4. You should use queue mechanism properly. In some cases, the queue is good but in other cases, it may not. If a client should receive some message sequentially, you should use the queue.


5. As a client may not respond, the server should set a timeout value. For example, if a timeout occurs, the server can request again to a client. In this time, the timeout value should be proper not bigger or not smaller. In a weak network state, it could need a longer time out value. But in this case, the request time could be delayed as much as the value.


6. A client may have a database which should be consistent with the server's one. But in this case, making consistency may be very difficult.


7. The server's threads should operate concurrently. In other words, you should check whether all threads operate at all time.


8. The testing environment is very important. As you know, in networking programming, debugging is very important as many threads operate asynchronously. You should leave major log message surely. If the log is shown at real time and stored as a file, it can be very helpful.