开发者

Scheduling Jobs On web server

开发者 https://www.devze.com 2022-12-31 14:29 出处:网络
We Want to Create an online game like this.I think that ,this type of games have a scheduling software on web server. For Example : Player Click to create a resource And resource creation will be take

We Want to Create an online game like this.I think that ,this type of games have a scheduling software on web server. For Example : Player Click to create a resource And resource creation will be take a moment like 20 Minutes.(Every resource creation time will be different). This message will send to web server application but this message will not processed at same time for example must be processed after 20 Minutes. The web server application after getting the message must be put the order in the Queue.

We have Some big problems :

1- The Jobs must be complete by the web server application Even the player Exit the Game. I think that we must create something like Windows service on Web Server. Can we do it? or I开发者_运维问答s there a better way?

2- The Second problem depended on problem 1 .Because we will have many Jobs (every player can create 20,30 Jobs in every Loggin and we will have thousands of users) , So Our Scheduling System Must be Work On time . it's possible that , there is 100 , 1000 jobs in a same second , if application Can't Done Jobs in him Second will be use the next second Time and the next second jobs will shift to next second and etc. How We can do for this problem ?

Platform : .Net 3.5 On Windows 2003 Web server

Cheers

Asad Safari

Agile Coach , Scrum Master


On unix, use cron to schedule a script to run every minute - the script then handles all the jobs.

http://en.wikipedia.org/wiki/Cron


Well the specific answer would depend on which technology/language/platform you're using. In java, check the scheduling services provided by Quartz to schedule jobs; and check JMS/MDBs to implement the asynchronous event processing you mention in question 2.


I think my answer won't exactly fit your question but it will solve your problem. Both points at once.

First at all, why do you want to automatize the execution of this events? As far as I understand, you need to give the player access to his resource if and only if he created the resource an especific time ago.

Well, this is my solution: Insert a field in your resource model class named usable_since or something like that and, when the player create his resource, just set it the value of this field to the current time plus the desired waiting time.

In this way you beat the two problems:

  1. the resource will be usable even if the player gets offline and
  2. you just won't need to set up so big job handler, even with a million users.

I hope it helps. I wish you the best luck in developing the game. Make it fun!


I had a somewhat similar question, as I'm also developing an application which relies on server-side scheduling: Job-Scheduling in Play! Framework. I use the Play Framework (Java) and it works like a charm; except I have no experience in how many jobs can be scheduled concurrently without bringing the server to its knees.

0

精彩评论

暂无评论...
验证码 换一张
取 消