Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am new one for rent a server. I choose a CentOS VDS width 2G memory. After apache+mysql+php install and setting, My server cost 750MB and 1297MB free (I use free -m to see it)

And then I run one page of mine (2 mysql fulltext union search, 4 jquery ajax process, 4 social plungin, one whether online api, header footer use php include), then use SSH free -m, I see the memory will increase into 835MB, one page cost 85MB memory...

So that my site will support less only few custom at same time, else the VDS provider will punish a over memory used ... I also read some article from google, some guy only rent a 256MB VPS, buy do a good job. So how to Optimization in my situation?

my.cnf

key_buffer_size = 256M
max_allowed_packet = 4M
table_open_cache = 256
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
ft_min_word_len = 2

Or still need modify php.ini?

Many thanks.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Operating systems are designed around the assumption that there is no cost associated with using memory that is available. They make no effort to free memory because the assumption is that you'd rather have the memory be used than free. Most of the time, this assumption is correct.

I would suggest you limit the system to the amount of memory you want to it to use. Avoid "burstable" or "overcommitted" memory setups. Give the operating system the amount of memory you actually want it to use, and expect it to use all of it.

You will know that you need more memory if you see performance problems and excessive disk I/O.

share|improve this answer
    
so how to limit the system to the amount of memory, can you teach me more? I am fresh to set up a server. whatever, 85M/per page is too terrible, the html+js+css+images, the total thing loading in this page are less than 5 MB... –  yuli chika Jan 11 '12 at 21:10
    
Choose a VDS with 1GB memory and it will be limited to 1GB. Don't give it any more memory than you want it to use. Your "85M/per page" is meaningless. It's not per page. (If you don't believe me, request 100 pages and see if it goes up to 8,500M. It won't, of course.) The operating system assumes that free RAM has no cost associated with use. If you don't want the OS to use RAM, don't give it to it. You will know you need more RAM when you see performance problems, paging, excess disk I/O, and so on. –  David Schwartz Jan 11 '12 at 21:13
    
hi @David Schwartz, thanks some lessons. So do you think im my server could support how many people online at the same time? and do you have further tutorials for excess disk I/O in CentOS? –  yuli chika Jan 11 '12 at 22:41
    
Are you seeing excess disk I/O? Tools like atop and iotop can help. As for how much load your server can support, there's really no simple formula. It depends on how much work your server has to do to serve a page and how long your users stay on each page, whether you use things like AJAX and so on. –  David Schwartz Jan 11 '12 at 23:00
    
I am reading the article http://wiki.centos.org/HowTos/Disk_Optimization. My site have many ajax post require and api get, even have many complex mysql full text union query. I know custom review my site is dynamic, and it is difficult get a precise number. However, based on your experience, probably how many could have? 10 , 50 or more (at the same time review my site)? Many thanks. –  yuli chika Jan 11 '12 at 23:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.