Amazon Interview Question
Software Engineer / Developershow many threads can you create at one time?
The questions seems to be related to load testing a web page - number of users might go upto 10000 at one time. Can you create 10000 threads and hold them without killing even one?
I like Ram's idea better...to reduce system resources so as to simulate a huge load with just 5-10 users.
Seshagiri
Seshagiri
In linux 10000 threads is a piece of cake. we can create 200,000 threads using the pthread library wihtout killing the threads. I think this number has increased much more in recent times.
How much can u test with one user? It is a decent idea but not good enough keeping amazon in mind. when we are talking about load it is 1000s and 1000s of users.
If you create a multithreaded prog, you are using a test tool you made. Also, you are testing the machine, your purpose is to test it the way it is. If you modify its properties, you need to have separate test scenarios.
Approach 1:
Ask team members to pose as users. Enable a profiler on the app server.
Approach 2:
Run a process scheduler. Most OSes offer a tool to schedule processes, not intended for testing purposes specifically.
Siege, a load-testing and benchmarking utility that will help stress test your setup before exposing it to the world.
siege -d10 -c50 filename
The -d option specifies the delay, while the -c option tells siege how many users it should simulate. Note that the -d option is a random interval between 0 and X seconds, with X being the number of seconds you specify -- so if you say 10 seconds, it may be 0 seconds, it may be 4 seconds, and so on -- it just won't be longer than 10.
This is a very interesting question. Mercury's Loadrunner tool uses virtual users as a way of simulating thousands of real world users.
- Ram Balakrishnan February 27, 2006If the task is to load test a web page without the use of a tool then I would probably reduce the system resources (virtual memory, page swaps, cpu, etc) to a great extent and then test from the perspective of a single user. I belive that this scenario is a parallel to testing with adequate system resources and simulating real world users via a test tool.