1

First something about the infrastructure:

We have migrated one of our backend/admin servers to amazon. The applications on this server are only used sporadically (max. 10 parallel users). We are using a t1.micro instance running Gentoo. As Webserver we are using nginx in combination with PHP-FPM. The problem is that sometimes the server is dead slow that means a page needs 10-20sec to load (max 2sec on my local dev environment, and these pages are heavy ... 80mb+). I tried to analyze and reproduce the error but only figured out the memory is okay (270mb free) while cpu load is at 100%

Configuration:

nginx has 2 workers and max. 1024 connections.

PHP-FPM (I removed the comments)

error_log = /var/log/php-fpm.log

...

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ; 
;;;;;;;;;;;;;;;;;;;;

[www]

listen = 127.0.0.1:9000

user = www
group = www

pm = dynamic

pm.max_children = 8

pm.start_servers = 2

pm.min_spare_servers = 2

pm.max_spare_servers = 4

pm.max_requests = 100

I hope some one has a clue what to do :)

Frido
  • 73
  • 1
  • 7

2 Answers2

3

EC2 micro instances provide short bursts of CPU, not constant CPU power. This is the expected behavior. micro instances will only provide full CPU power for a few minutes at most then they limit it back to about 5-10% capacity. If you look in top you'll see a high value for 'st', this is CPU steal from the hypervisor (I.E. CPU you can't use/is thin provisioned).

Instances of this family provide a small amount of consistent CPU resources and allow you to burst CPU capacity when additional cycles are available. They are well suited for lower throughput applications and web sites that consume significant compute cycles periodically

-Amazon

1

Take a look at http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/concepts_micro_instances.html where you will find detailed information on t1.micro and how it comares to other instance types (like m1.small). It will help to understand the instance's behaviour.

Short: As soon as you exceed the "short burst" phase you will be getting a high amount of cpu 'st' (shown with top) which is slowing down everything.

RalphR
  • 26
  • 1