I have a system which runs at 100- 500 users at any one time, the incoming port 80 is only going to a load balance program (also written in WE) . It keeps a count of the number of connections currently on the main apps which it requests a count from the app via a EasyTCP connection every minute.
Whichever has the least gets the user redirected to it via a script which is sent via port 80 to send them to port 9000,9001,9002,9003 etc…
I am at home now but if you need help I can post some code on Monday.
you can configure your browser to NOT do forwarding ( quite a few large organizations do this by default ). So there browser just sits there. Anyone figured an easy way around this?
If the EasyTCp connection drops you assume the app has crashed and can re-start it.
You can run many apps, we run 4 as a base and have another 4 for when the load is heavy.
I have found WE really can only handle less than 100 connections and will happily handle 50 or so. I try to balance so the new server comes in at 200,250,300,350 and after that it is “take what you can get”.
Keep in mind I use console apps to handle most of the real load. I.e. if a report needs to be generated then it is sent to a console app and a timer looks for a “finished.txt” to be created it then sends the user the “result.pdf”. In this way the WE app never really has much use except to show the UI .
use lots of console apps and timers to see if they have finished. You want the main apps CPU usage to stay as low as possible to maintain the speed for all users. This is where you will spend most of your time. If one user requests a report which uses 100% CPU even for a few seconds it kills the UI for all the other users which leads to lots of hate mail. Console apps are great and once you start with them you will find it a simple process to change existing code to this “multi-thread” approach and when you are really into it you actually multi thread the console apps. For example our site will generate labels so it is common for us to run 4 console apps to generate one set of labels. Takes 1/4 of the time (roughly) and since windows works out which core of the CPU has the least load it is windows which does the load balancing for you.
try to use SQL commands which end in “LIMIT 0,50”. If you don’t need to fill a listbox with 100’s of rows of data then don’t most people only look at the top 20 rows anyway. Give them a option to “Show All” and pop up a warning that “this may take a while”, it also slows the whole thing down for all the other users on that app (port 9000) as well so use sparingly as it hogs the CPU.
bring app in when you need them to speed up the whole process, running 8 apps at 25 users runs slower than 4 apps at 50. It just does.
When you compile the app use a script so that you change the app name and port number to compile it 4 times.
You don’t have to run all the WE apps on one machine , you can load balance over multiple machines. I use 2 on 2 machines and then add another 2 to each machine when required. There is nothing to stop me adding machines when required ( probably later this year ) simply by cloning an existing machine and replacing the WE apps. You just set your router to forward a group of ports to the other machine. 9000-9003 to machine A - 9004-9007 to machine B - presto scalable load balancing
Have your SQL server on a dedicated machine. Make sure you don’t use the standard port and don’t have it open to the world.
Remember in windows each instance of the WE app will be running on a separate CORE of the CPU so 8 cores means you can happily run 2 or 4 WE apps without them effecting each other. Stay away from WE and single core processors, you really need a 4 core at least to have any chance with the above.
Hope this helps - there is lots more but you will work it out.