deploying CPU intensive web service on cloud
I have an application which I want to expose as a web service (SaaS). The application is CPU intensive and is a multithreaded application which takes good amount of time for the execution(on an average 15-20secs). Since, I want to expose it as a SaaS and want to use existing cloud services available in the market like Amazon, Google App Engine etc. so that the cost involved and the work involved while scaling my service is not much. I have couple of questions in my mind like: 1.) Since the application is multithreaded and the number of threads invoked depends on the number of results thrown by the service(so basically number of threads is a dynamic entity). Right now I have a 6 core processor so I have kept the threadpool size to be 6 but since I am moving onto the cloud, how can I optimally use the cloud infrastructure? 2.) Do the cloud service providers(which?) give the option to select number of CPU cores required for each request (or something similar to serve my purpose)? 3.) What changes are needed in the code (related to the threads)? 4.) Any other specific area which I should give a sight for moving to the cloud?
In Amazon EC2 you are basically paying for different types of instances - you are free to pick one with only single core and one with sixteen. You get what you pay for. how can I optimally use the cloud infrastructure? Your approach is fine, if your task is CPU-intenstive, have a thread pool with the same number of threads as CPU cores/CPUs. select number of CPU cores required for each request No, at least not Amazon. You run your application on a given instance and that's all you get. You have to pick instance type in advance, but of course you are free to switch between them, add new, etc. at any time. The cloud! In Google App Engine you can't create threads, so it's a no-option for you. See also: Why does Google App Engine support a single thread of execution only? 3.) What changes are needed in the code (related to the threads)? None. It's a standard PC, after all. 4.) Any other specific area which I should give a sight for moving to the cloud? Well, see above, some services are completely useless for you, like GAE. Make some research before you actually pay for something.
Does Linux drop into the kernel on all cores?
Performance counters for current threads
winsock 2. thread safety for simultaneous send's. tcp
How to implement cancellable worker thread
Do I need to lock object when reading from it?
A Thread Scheduler for an Real Time Embeded Operating System
What does threadsafe mean?
Threads on WindowsXP
Reading log from Log4Net generated by multiple threads
Heavy weight and light weight thread
What operations are thread-safe on std::map?
Analyzing output of !threadpool and !threads in windbg
Copying files which the main thread adds to a stringlist using a thread
what is the difference between synchronous apis and asynchronous apis?
How to define threadsafe?
Is the go map structure thread-safe?