0
votes

I am running a tornado client-side application on AWS EC2 with a Linux t2.micro instance which includes 1 vCPU and 1 GiB of RAM. I have noticed that I the application performance and speed slows after 75 simultaneous HTTP connections.

Considering that tornado runs on a single process-thread (using an event loop asynchronous architecture) - I am wondering if upgrading to an AWS t2.medium instance with 2 vCPU's would actually help.

In theory, can a single process with a single thread be run on two CPU's? Or is Amazon's vCPU not a real CPU and just a measurement of processing power?

1
Check the how much processor and RAM is being used at 75 simultaneous connections. You may also need to profile you code. Are you doing some memory heavy process with client ? - Sumeet P
Yes, I used the top command and I see that the process is using 72% memory. That is the optimal usage that I know from profiling my code with timestamps - and also looking at throughput which is optimal at that point with 75 HTTP connections. I am also not doing any processing that would take up any more memory at all. But I just want to know if having a second vCPU would help or not considering that tornado is a single process/thread framework. Or if having more RAM would help. - etayluz
It's AWS - just try it and see what happens! Costs next to nothing :) - Raf

1 Answers

1
votes

Tornado supports running multiple Python processes to take advantage of a multi-CPU machine. As described in the documentation, you can use Tornado itself to fork those processes, or you can set a load balancer proxying a number of processes started either manually or using some manager like supervisor.

As for your second question, apparently an AWS vCPU is basically a single hyperthread spawned from a real processor core, which should in Python's case amount to the equivalent of a "real" CPU (but I'm far from being an expert on the topic).