Home > other >  Supports distributed task regularly middleware golang?
Supports distributed task regularly middleware golang?

Time:09-15

Your bosses, because now go is cluster pattern, there are n servers, such implementation timing task only in a stage to perform at the same time, based on web development

CodePudding user response:

There are several solutions
1. Only one server startup time task (the other server does not start timing task)
2. Through the environment variable controls whether to launch timing server (go read the environment variables, only one server environment variable is time service, launch the other server environment variable is not start timing service)
3. If you use the same database, can be controlled by lock table records
4. Similar to 3, don't lock table directly, but to a center service application to perform a task, once a center services have repeated application refuses to perform a task
, etc.

CodePudding user response:

reference 1st floor qybao response:

there are several kinds of scheme1. Only one server startup time task (the other server does not start timing task)
2. Through the environment variable controls whether to launch timing server (go read the environment variables, only one server environment variable is time service, launch the other server environment variable is not start timing service)
3. If you use the same database, can be controlled by lock table records
4. Similar to 3, don't lock table directly, but to a center service application to perform a task, once a center services have repeated application refuses to perform a task
And so on

Is there any middleware can support directly, we can use these methods

CodePudding user response:

Use etcd solve

CodePudding user response:

Go cron
  • Related