From: 一首诗 on
Hi all!

I am preparing to write a server application (you may think of it as
an online game server), but I not sure how to do it correctly. For
example$B!=!=(B

1. UDP or TCP$B!$(Bwhich one could gain more performance?

2. Should I catch data in memory instead of write it to db
immediately?

3. How to make it run on cluster?

4. How to make hot backup?

5. Java or C/C++ or something else?

6. What is happening when an IP package was received?

7. Could I get some inspiration from how people write web server?

$B!D!D(B

And so on..

Is there any classical book talking about these kind of issues?
Thanks a lot
From: Richard Heathfield on
[indecipherable] said:

> Hi all!
>
> I am preparing to write a server application (you may think of it as
> an online game server), but I not sure how to do it correctly. For
> example??
>
> 1. UDP or TCP?which one could gain more performance?

Those who ignore TCP are condemned to re-invent it. TCP is slower, yes, but
there are three good reasons for that. If you go the UDP route, you will
discover these reasons for yourself.

> 2. Should I catch data in memory instead of write it to db
> immediately?

And what if, later on, you decide to have multiple servers? How are they
going to look things up in each other's caches? You may find it a lot
cleaner to write data to the database as and when you collect it.

> 3. How to make it run on cluster?

Use a local area network to allow each server to talk to the others.

> 4. How to make hot backup?

850W for 3 minutes.

> 5. Java or C/C++ or something else?

Latte.

> 6. What is happening when an IP package was received?

Data.

> 7. Could I get some inspiration from how people write web server?

Source available here: http://httpd.apache.org/download.cgi

> Is there any classical book talking about these kind of issues?

I don't think you're going to find all of the above issues discussed in a
single good book.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
From: Phlip on
$B0l<s(B? wrote:

> I am preparing to write a server application (you may think of it as
> an online game server), but I not sure how to do it correctly. For
> example$B!=!=(B
>
> 1. UDP or TCP$B!$(Bwhich one could gain more performance?

You need to Google for ["free software" game middleware]. That should get
you started. There is doubtless already a good package out there. If you
don't actually use it, you can "learn from" it! (-;

(BTW to broadcast packets to many clients, who don't care if they miss a
packet, use UDP. Use TCP to actually sync the mission-critical game events.
And good luck with security!!!)

--
Phlip
http://www.oreilly.com/catalog/9780596510657/
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax