MULTIPLE XBASE SERVICES

This forum is for general support of Xbase++
Post Reply
Message
Author
bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

MULTIPLE XBASE SERVICES

#1 Post by bwolfsohn »

I asked this on the xb2net newsgroup and got no response.. Wondering if anyone here has this situation, and how they handle it..
************************************
We run multiple instances of our online xb2net apps.

We set up additional directories, and run them on different ip's.

we rename the exe's, since it looks like you can't have the same exe
running twice as a service. and we install the apps as a service via a
batch file.

We 're setting up new/additional hardware to run some of our apps, and I
was wondering if anyone else out there is running multiple instances of
xb2net apps as services, and what methodology do you use to set-
up/instantiate them ??

I'm interested in any suggestions about a more "efficient" approach to
adding additional instances of the app.

thanks
Brian
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
jdsoft
Posts: 113
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

Re: MULTIPLE XBASE SERVICES

#2 Post by jdsoft »

Hello Brian,

I was strugling with same problem some time ago.
In the end, i managed to have a single service, that hosted all IP adresses.

The key was to pass an extra parameter.

oServer:onGet := {|o| HttpHandler(o,cLand)}
oServer:onPost := {|o| HttpHandler(o,cLand)}
oServer:onSOAP := {|o| SOAPHandler(o,cLand)}

The parameter is representing a country id,

In HttpHandler, i change threadsave path and file locations.
These are used in the code for processing.

Regards,
Jack Duijf
Regards,
Jack Duijf

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: MULTIPLE XBASE SERVICES

#3 Post by rdonnay »

Brian -

I wrote a multiple services system for Bobby Drakos that is based on the template in \exp19\samples\services\services.prg.

He currently runs 6 different services in a single application.

Roger
The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: MULTIPLE XBASE SERVICES

#4 Post by bwolfsohn »

jdsoft wrote:Hello Brian,

I was strugling with same problem some time ago.
In the end, i managed to have a single service, that hosted all IP addresses.

In HttpHandler, i change threadsave path and file locations.
These are used in the code for processing.
Jack,

Thanks for the suggestion... but, we already do all of that..

Our filepath switching is based on the incoming url, all sharing the SAME ip#. so we only have to use a single ip to handle dozens of different filepaths/clients.

abc.mycompany.com will go to abc's files and xyz.mycompany.com will go to xyz's files.

Your answer is actually the reverse of what we're looking for... sometimes, we have over 300 people at one time hitting the service, and they may hit it every couple of seconds. we're trying to scale to handle 3 or 4 times this load. We've just offloaded a significant portion of the data (pictures) to a different machine and different url's, to lighten the load. Eventually, we may store most of the data in an array in memory to reduce database load, and only hit the database when writing (and replicate that to the array).

Sometimes, a client will screw up the service, in spite of our best efforts to insulate these situations. (the old adage: the program is idiot-proof, but these idiots keep getting smarter)

We may also put an individual client on their own service, or switch them to their own machine based upon load..

We've made the decision that we need to utilize multiple instances of the SAME application (just monitoring different ip's) in order to handle the load by distributing it across multiple exe's, cpu's, and machines.

I'm looking for suggestions about how to best handle multiple identical exe's on the same machine.
naming, installations, batch files, etc..

All the best
Brian
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: MULTIPLE XBASE SERVICES

#5 Post by rdonnay »

Brian -

Are you absolutely sure you can't have 2 services with the same EXE name?

I don't think that is correct.
I believe that they just cannot have the same service name.

Roger
The eXpress train is coming - and it has more cars.

User avatar
jdsoft
Posts: 113
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

Re: MULTIPLE XBASE SERVICES

#6 Post by jdsoft »

Hello Brian,

Jus read Roger's message.
You CAN install the same exe more then once as a service with a different servicename.
The only challange is to instruct the service to listen to speciffic IP adresses.
You could do this if you install each instance of the exe in a seperate Map:
C:\Webserver\Service_1\myservice.exe
C:\Webserver\Service_2\myservice.exe
C:\Webserver\Service_3\myservice.exe
And read the settings from a "ini" file located on same location as the EXE
Remember that the CurDir() of a service is not the location of the exe.

Now i think of it:
If the first service runs on IP address 192.168.0.100 port 80, and the 2nd service starts, it wil be unable to start the server on the same IP address or port.
Then increase the IP address by 1 to 192.168.0.101, and retry. You can keep on increasing until you are able to start the server.
This way, you need only 1 instance of the EXE, and install and run as many services you require.

Regards,
Jack Duijf
Regards,
Jack Duijf

Post Reply