Multithreaded Gammu

If you’ve already installs and use open-sourced Gammu for some time, especially the SMS daemon or services, you will notice that each communication port is handled by one Gammu service.

So, if there are 8 active modems in 8 ports using a modem pool, there should be 8 windows services, when the Gammu SMS service is installed in windows environment.

Each of the port will run on separated applications, and this will become issue, when there’s the requirement to perform load balancing and other features that requires overall knowledge about each state of the port.

Using this construction, it is necessary to create the application to augment the management functionality for the above purposes, and existing client application should be re-routed to this service before it is forwarded to the respective Gammu SMS Services.

The other alternatives is to enhance the existing Gammu SMS service to cope with this demand, by utilizing the Manager – Slave concept and the multithreading technology provided by operating system.

In this new construction, there will be a manager and slave object. The manager will perform necessary assignment based on load balancing parameter given by the configuration file, and the slave objects, which is spawned by the manager using multithreading technology.

By using the above construct, there will be only one service, i.e. the SMS Manager which can be easily controlled by an admin. Activating each of the slaves can be done only by adding the new section to the configuration file, and restart the manager.

I’ve recently has a project that involves an application that will utilizes 8 to 16 ports of the modem. Each modem has its rule to send/receive the message based on mobile operators of the modem’s SIM card. Each modem has an per day SMS quota and when it reaches the quota, the manager will stop the sending process. Each modem should report the remaining pulse amount daily. The manager should distribute the SMS request in round-robin method to speed up the sending latency time. The manager should watch out for the dead modem and re-route the given task previously to that modem to the other one.

You can imagine the amount of efforts to be taken if there are separate services for each 8 to 16 modems and to make sure each of the modem should be run smoothly with 7×24 availability šŸ™‚

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: