How to increse apache 2 and mysql performance and howmany users can give exam at a time in my server

How to increse apache 2 and mysql performance and howmany users can give exam at a time in my server

by lalit thakur -
Number of replies: 5

Hello

i am using moodle 3.2 , mysql - 5.5.49 0ubantu0.12.04.1 , Apache 2

And 48 GB RAM , 1 TB HDD, ubutu 14.04 LTS Command based OS ,

i have 500 users but when 200 users give exam at a time then server speed is very slow, server take 2 or more minute to open a question .

Please help me how can i provide a exam for 500 users at a time

Detail of  mysql and apache2 and php -->

my.cnf  for mysql


key_buffer        = 16M
max_allowed_packet    = 16M
thread_stack        = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 500
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit    = 1M
query_cache_size        = 16M

[mysqldump]
quick
quote-names
max_allowed_packet    = 16M

[mysql]
#no-auto-rehash    # faster start of mysql but no tab completition

[isamchk]
key_buffer        = 16M


apache2.conf for apache2


# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    ServerLimit           400       
    MaxClients         350
    MaxRequestsPerChild   5
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
#              graceful restart. ThreadLimit can only be changed by stopping
#              and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    ServerLimit           400
    MaxClients          350
    MaxRequestsPerChild   0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreas: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    ServerLimit           400
    MaxClients         350
    MaxRequestsPerChild   0
</IfModule>

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}


and memory detail is ---: (Command Free)

Memory

Total - 49748700

used - 895628

free - 48859072

shared - 0

buffers - 164848

cached - 488188

Buffers/cache

used - 242592

free - 49506108

Swap

total - 134217724

used - 0

free - 134217724





Average of ratings: -
In reply to lalit thakur

Re: How to increse apache 2 and mysql performance and howmany users can give exam at a time in my server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Moving to Hardware and performance forum...

In reply to lalit thakur

Re: How to increse apache 2 and mysql performance and howmany users can give exam at a time in my server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

200 users all starting a quiz at the same time can put quite a load on any system. Is there any way you can stagger the start?

What have you done to investigate what the system is doing while the quiz is actually running? As I starting point, I normally recommend something like Munin which graphs various resources against time. You can see what resource is an issue at the time of the quiz.

In reply to Howard Miller

Re: How to increse apache 2 and mysql performance and howmany users can give exam at a time in my server

by lalit thakur -

Thank you Howard Miller for the reply

Actually i have no more experience about this, Can you tell me the steps to judge my server ,

And my question was that my configuration of MySQL and Apache2 is compatible to my server configuration


Thank you

In reply to lalit thakur

Re: How to increse apache 2 and mysql performance and howmany users can give exam at a time in my server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Your parameters don't look ridiculous (at a glance) but I have no way to say if they suit your needs. Some things to think about...

- How much memory are you allocating to MySQL and how much to Apache if they are on the same box/VM?

- Run Munin or something like it. You need to be able to see what's happening to resources when the system is 'slow'. Make sure you install all the plugins for Apache and MySQL (e.g. you need to know how many connections are being used)

- 350 child processes for Apache may not be enough for a large quiz class. Have you checked running processes when the quiz class starts? Don't just increase it though - Moodle is a big application and the other issue is that setting this too high tries to use more memory than you have. 

- Have you run one of the MySQL tuning scripts?