I'm focusing on something that splits customers by organization. Each user goes for an organization. Each organization stores its data in the own database which resides on the database server machine. A db server may manage databases for 1 or even more organizations.
The present (legacy) system assumes there's just one organization, however I wish to 'scale' the applying by running an 'instance' from it (associated with one organization), and run several instances around the server machine (i.e. run multiple cases of the 'single organization' application Body instance for every organization).
I'll give a Peaceful API for every instance that's running around the server, to ensure that a thin client may be used to access the help supplied by the instance running around the server machine.
This is a simple schematic that demonstrates the associations:
Server 1 -> N database (each organization has one database)
organization 1 -> N customers
My question pertains to how you can 'direct' Peaceful demands from the client, towards the appropriate instance that's handling demands from customers for your organization.
More particularly, after i get a Peaceful request, it will likely be from the user (who goes for an organization), how (or indeed, what's the easiest way) to 'route' the request towards the appropriate application instance running around the server?
From things i can gather, this really is basically a sharding problem. No matter the way you split the events in a hardware level (using VMs, multiple servers, all on a single effective server, etc), you'll need a central registry and brokering layer inside your overall architecture that maps given customers towards the correct destination instance per request.
You will find many different ways to implement this obviously, so just pick one you know and it is fast, and can scale, as all demands can come through it. I recommend a light-weight stateless web application backed with a simple read only database that does the right client identifier -> instance mapping, that you simply would load into memory/cache. To include versatility on hardware and instance location, use (presuming Java) JNDI to keep the hardware/port/etc information for every instance, as well as in your identifier mapping map the customer identifier towards the appropriate JNDI research key.
Letting the general public API only specify the consumer sounds just a little fragile in my experience. I'd alter the public API to ensure that demands specify organization in addition to user, after which have something trivial server-side that maps organizations to instances (eg. organization foo -> instance listening on port 7331).
That's a really tough question indeed due to the fact you will find many possible solutions, and which is the greatest are only able to be based upon both you and your atmosphere.
I'd write an apache module in C++ to achieve that. Using this book, I handled to begin writing extremely powerful modules.
To have the ability to provide you with more solutions (maybe just establishing a Squid proxy?), you will need to specify the way you will have the ability to determine that server you have to redirect the customer. If it can be done by Insolvency practitioners, though a GET param, though a Publish XML param (like Cleaning soap). Etc.
Because the other answer states you will find many different ways to approach this problem. Allows assume you don't get access to legacy software source code, and that means you cannot modify it to pay attention on different ports for various instances.
Writing Apache module appears VERY extreme to resolve this problem (and as somebody who really just finished writing a production apache module, I would recommend staying away from it unless of course you're making serious money).
The approach is often as esoteric as you desire. For example in case your legacy software operates on normal Apple architecture and you've got the hardware capacity you will find VM solutions, best places to have the ability to produce a thin virtual machine, one managing a single demonstration of the program along with a multiplexer to tie all of them.
If however you're running something similar to HPUX well :-) you will find other approaches. What about you allow a little more detail?