The architecture and technologies to use for a secure, fast, reliable and easily scalable web application
^ *For actual questions, skip to the lists down below*

I understand, that his is a vague topic, but please, before you turn the other way and disregard me, hear me out. I am currently doing research for a web application(I don't know if application is the correct word for it, but I will proceed w/ that for now), that one day might need to be everything mentioned in the title. I am bound by nothing. That means that every language, OS and framework is acceptable, but only if it proves it's usefulness. And if you are going to say, that scalability and speed depend on the code I write for this application, then I agree, but I am just trying to find something, that wouldn't stand in my way later on.

I have done quite a bit reading on this subject, but I still don't have a clear picture, to what suits my needs, so I come to you, StackOverflow, to give me directions. I know you all must be wondering what I'm building, but I assure you, that it doesn't matter. I have heard of *12 factor app* though, if you have any similar guidelines or what is, to suggest the please, go ahead.

For the sake of keeping your answers as open as possible, I'm not gonna provide you my experience regarding anything written in this question.

^ *Skippers, start here* 

First off - the weights of the requirements are probably something like that (on a scale of 10):

 - Security - 10
 - Speed - 5
 - Reliability (concurrency) - 7.5  
 - Scalability - 10

*Speed and concurrency are not a top priority, in the sense, that the program can be CPU intensive, and therefore slow, and only accept a not-that-high number of concurrent users, but both of these factors must be improvable by scaling the system*

Anyway, here are my questions:

- **How many layers should the application have, so it would be future-proof and could best fulfill the aforementioned requirements?** For now, what I have in mind is the most common version: 
    1. Completely separated front end, that might be a web page or an MMI application or even both.
    2.  Some middle-ware handling communication between the front and the back end. This is probably a server that communicates w/ the front end via HTTP. How the communication w/ the back end should be handled is probably dependent on the back end.
    3. The back end. Something that handles data through resources like DB and etc. and does various computations w/ the data. This, as the highest priority part of the software, must be easily spread to multiple computers later on and have no known security holes. I think ideally the middle-ware should send a request to a queue from where one of the back end processes takes this request, chops it up to smaller parts and buts these parts of the request back onto the same queue as the initial request, after what these parts will be then handled by other back end processes. Something *map-reduce*y, so to say.
- **What frameworks, languages and etc. should these layers use?**
    1. The technologies used here are not that important atm, you can ignore this part for now
    2. I've been pointed to node.js for this part. Do you guys know any better alternatives, or have any reasons why I should (not) use node.js for this particular job.
    3. I actually have no good idea, what to use for this job, there are too many options out there, so please direct me. This part (and the 2. one also, I think) depend a lot on the OS, so suggest any OSs alongside w/ the technologies/frameworks. 

Initially, all computers (or 1 for startes) hosting the back end are going to be virtual machines.   

Please do give suggestions to any part of the question, that you feel you have comprehensive knowledge and/or experience of. And also, point out if you feel that any part of the current set-up means an instant (or even distant) failure or if I missed a very important aspect to consider.

I'm not looking for a definitive answer for how to achieve my goals, because there certainly isn't one, for I haven't provided you w/ all the required information. I'm just looking for recommendations and directions on what to look into. Also, bare in mind, that this isn't something that I have to get done quickly, to sell and let it be re-written by the new owner (which, I've been told for multiple times, is what I should aim for). I have all the time in the world and I really just want to learn doing something really high-end. Also, excuse me if my language isn't the best, I'm not a native.

Anyway. Thanks in advance to anyone, who takes the time to help me out here.

PS. When I do seem to come up w/ a good architecture/design for this project, I will certainly make it an open project and keep you guys up to date w/ it's development. As in what you could have told me earlier and etc. 

*If you feel this is not the correct location for this question/topic, please direct me somewhere you feel this would fit in better.*
The architecture and technologies to use for a secure, fast, reliable and easily scalable web application
===

^ *For actual questions, skip to the lists down below*

I understand, that his is a vague topic, but please, before you turn the other way and disregard me, hear me out. I am currently doing research for a web application(I don't know if application is the correct word for it, but I will proceed w/ that for now), that one day might need to be everything mentioned in the title. I am bound by nothing. That means that every language, OS and framework is acceptable, but only if it proves it's usefulness. And if you are going to say, that scalability and speed depend on the code I write for this application, then I agree, but I am just trying to find something, that wouldn't stand in my way later on.

I have done quite a bit reading on this subject, but I still don't have a clear picture, to what suits my needs, so I come to you, StackOverflow, to give me directions. I know you all must be wondering what I'm building, but I assure you, that it doesn't matter. I have heard of *12 factor app* though, if you have any similar guidelines or what is, to suggest the please, go ahead.

For the sake of keeping your answers as open as possible, I'm not gonna provide you my experience regarding anything written in this question.

^ *Skippers, start here* 

First off - the weights of the requirements are probably something like that (on a scale of 10):

 - Security - 10
 - Speed - 5
 - Reliability (concurrency) - 7.5  
 - Scalability - 10

*Speed and concurrency are not a top priority, in the sense, that the program can be CPU intensive, and therefore slow, and only accept a not-that-high number of concurrent users, but both of these factors must be improvable by scaling the system*

Anyway, here are my questions:

- **How many layers should the application have, so it would be future-proof and could best fulfill the aforementioned requirements?** For now, what I have in mind is the most common version: 
    1. Completely separated front end, that might be a web page or an MMI application or even both.
    2.  Some middle-ware handling communication between the front and the back end. This is probably a server that communicates w/ the front end via HTTP. How the communication w/ the back end should be handled is probably dependent on the back end.
    3. The back end. Something that handles data through resources like DB and etc. and does various computations w/ the data. This, as the highest priority part of the software, must be easily spread to multiple computers later on and have no known security holes. I think ideally the middle-ware should send a request to a queue from where one of the back end processes takes this request, chops it up to smaller parts and buts these parts of the request back onto the same queue as the initial request, after what these parts will be then handled by other back end processes. Something *map-reduce*y, so to say.
- **What frameworks, languages and etc. should these layers use?**
    1. The technologies used here are not that important atm, you can ignore this part for now
    2. I've been pointed to node.js for this part. Do you guys know any better alternatives, or have any reasons why I should (not) use node.js for this particular job.
    3. I actually have no good idea, what to use for this job, there are too many options out there, so please direct me. This part (and the 2. one also, I think) depend a lot on the OS, so suggest any OSs alongside w/ the technologies/frameworks. 

Initially, all computers (or 1 for startes) hosting the back end are going to be virtual machines.   

Please do give suggestions to any part of the question, that you feel you have comprehensive knowledge and/or experience of. And also, point out if you feel that any part of the current set-up means an instant (or even distant) failure or if I missed a very important aspect to consider.

I'm not looking for a definitive answer for how to achieve my goals, because there certainly isn't one, for I haven't provided you w/ all the required information. I'm just looking for recommendations and directions on what to look into. Also, bare in mind, that this isn't something that I have to get done quickly, to sell and let it be re-written by the new owner (which, I've been told for multiple times, is what I should aim for). I have all the time in the world and I really just want to learn doing something really high-end. Also, excuse me if my language isn't the best, I'm not a native.

Anyway. Thanks in advance to anyone, who takes the time to help me out here.

PS. When I do seem to come up w/ a good architecture/design for this project, I will certainly make it an open project and keep you guys up to date w/ it's development. As in what you could have told me earlier and etc. 

*If you feel this is not the correct location for this question/topic, please direct me somewhere you feel this would fit in better.*