开发者

Application Profiling: Memory Usage

I have switched on the Codeigniter profile (very useful) and I have noticed that a page of mine shows the memory used as:

2,405,496 bytes

That's ~2MB and it's for one request - does it mean if 1000 users accessed this page at the same time, memory usage will be 2GB?

Have I got my maths wrong or is there more to this than just multiplying two numbers?

Thanks all for any help

EDIT

Is this sort of memory usag开发者_Python百科e normal for a script running 2 simple select queries? I do autoload helpers such as form, url and also Database and session classes.


2MB is not that much -- it doesn't look surprising to me, at least ; I often see much higher values, when using a framework, even if not doing lots of SQL queries.

Note that the memory_limit, which defines how much memory a PHP script can use, if often set to at least 8MB -- and quite often 16 or even 32 MB.

if 1000 users accessed this page at the same time

First of all, are you sure your application will be successful enough to have one thousand users requesting a page at the same time ? Note that if you need need 1 second to generate a page (which is already a bit long), it means having 1,000 users requesting a page in that one second !

Then, anyway, your server will probably never support that load -- by default, I should add that Apache is generally configured to not serve more than something like 200 concurrent requests.

If you really expect to have 1,000 users at the same instant on your application, you'll have plenty of other problems, I'd say -- and you'll probably have to optimise a lot, and/or use more than one server.


Yes, but most likely you wont have 1000 users accessing your page at the very exact same instant. It will be spread out over a few seconds/minutes/etc. Plus I doubt your webserver could even handle 1000 concurrent connections.


With my grammar school math.

1000 rps is equivelant to
86400 * 1000 = 86400000 views per day 
which is also equivalent to 
2592000000 views per month. 
which is 2592 MILLION page views per month. 
Or , 2.5 BILLION page views per month.

So you are talking about a website more popular than linkedln, which gets 1.9 billion views per month.

Do you think linkedln runs in one box?

Helpful answer:

I average about 3MB in my CI applications. Havent done any aggressive optimization, but I think you should be happy with your 2MB figure.


Do you know how much memory consumed by Drupal or wordpress, If you check that on fresh installation you will find following data.

Fresh installation Wordpress 12.66MB memory use
Fresh instillation Drupal 14.66MB memory use

I can say 14 to 16 MB memory use is normal.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜