Sign inSign up

zilutian/web-serving

By zilutian

•Updated about 7 years ago

Image
0

634

zilutian/web-serving repository overview

⁠TL;DR

Update the suffix -amd64 according to your architecture (arm64 or amd64) One way to get your host IP is command (ip route get 1). The IP after src is your host IP

docker run -dt --net=host --name=mysql_server zilutian/web-serving:db-server-amd64 *host-ip* 
docker run -td --rm --net=host --name=memcache_server zilutian/memcached memcached -u root -m 65535 -t 4
docker run -dt --net=host --name=web_server zilutian/web-serving:web-server-amd64 /etc/bootstrap.sh 
docker run --net=host -e JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 --name faban_client zilutian/web-serving:faban-client-amd64 localhost *number_of_users*

⁠Detailed explanation

There seems to be an issue with the markdown support for angle bracket after docker hub's update. This page is still under construction, and will be updated accordingly.

⁠Instructions for bringing up database server

First, get your host IP. One way to achieve this is shown below and the IP after "src" is your host IP

ip route get 1 

Substitute host-ip with your actual IP when using --net=host option.

docker run -dt --net=host --name=mysql_server zilutian/web-serving:db-server-amd64 host-ip

You can check the log file of the container to make sure the database is up and running

docker logs mysql_server 

You should see something similar to the following:

+ service mysql restart
 * Stopping MySQL database server mysqld                                                         [ OK ] 
 * Starting MySQL database server mysqld                                                                
No directory, logging in with HOME=/
                                                                                                 [ OK ]

...
mysql  Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using  EditLine wrapper

...
 * Stopping MySQL database server mysqld                                                         [ OK ] 
+ /usr/sbin/mysqld

You can also probe into the container and check that ELGG_DB is indeed generated with user being populated with the default admin account

docker exec -it mysql_server /bin/bash

Once inside the container, connect to the database using command

mysql -u root -p

The password is "root". If successful, you should see

Welcome to the MySQL monitor.  Commands end with ; or \g.
...

Now you can check the content of the database. Below are just some suggestions

mysql> show databases; 
mysql> use ELGG_DB;
mysql> show table status;
mysql> show tables;
mysql> describe elgg_users_entity;
mysql> select username from elgg_users_entity;
mysql> exit; 

Some system-related SQL queries to monitor the performance:

SHOW TABLE STATUS from ELGG_DB;
SHOW GLOBAL STATUS LIKE 'max_used_connections'; # may need to tune var max_connections if benchmarking with high user count
SHOW GLOBAL STATUS LIKE 'Threads_created'; 
SHOW GLOBAL STATUS LIKE 'connections'; 
SHOW GLOBAL STATUS LIKE 'Open_%';
SHOW VARIABLES LIKE "%thread_concurrency%";
SHOW VARIABLES LIKE "%slow_query_log%";
SHOW ENGINE INNODB STATUS;   #only if used image tagged with -innodb; Otherwise the default MyISAM storage engine is used 

SELECT 
    ->     table_schema 'Database Name',
    ->     SUM(data_length + index_length) 'Size in Bytes',
    ->     ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) 'Size in MiB'
    -> FROM information_schema.tables 
    -> GROUP BY table_schema;

# Get a trace of all the queries executed
SET GLOBAL slow_query_log=ON;
SET GLOBAL long_query_time=0
⁠Instructions for bringing up memcached server
docker run -td --rm --net=host --name=memcache_server zilutian/memcached:amd64 memcached -u root -m 128 -t 1

Can obtain the memory config and thread count through carefully monitoring the resource usage of the caching server

-m 128: the memory limit [MB] of memcached
-t 1: the number of memcached threads 

Make sure the database server is up by checking the status of containers

docker ps 

and make sure the status of the memcache_server is "Up ..." Alternatively, you can set the memcached to verbose mode by adding -vv and check the log

You should see similar output:

slab class   1: chunk size        96 perslab   10922
slab class   2: chunk size       120 perslab    8738
slab class   3: chunk size       152 perslab    6898
...
26 server listening (auto-negotiate)
27 server listening (auto-negotiate)
⁠Instructions for bringing up NGINX server with ELGG

Arguments ${DATABASE_SERVER_IP} ${MEMCACHED_SERVER_IP} ${MAX_PM_CHILDREN} are optional. ${DATABASE_SERVER_IP} and ${MEMCACHED_SERVER_IP} use the default IP (127.0.0.1). ${MAX_PM_CHILDREN} set the pm.max_children in the php-fpm setting. Default value is 80.

docker run -dt --net=host --name=web_server zilutian/web-serving:web-server-amd64 /etc/bootstrap.sh ${DATABASE_SERVER_IP} ${MEMCACHED_SERVER_IP} ${MAX_PM_CHILDREN}

To verify NGINX is responding properly,

curl localhost:80

should return the welcome page of NGINX.

...
<title>Welcome to nginx!</title>
...

To verify ELGG is responding properly,

curl localhost:8080

should return the login page of elgg.

... 
<title>Elgg_community</title>
...
<div id="login-dropdown">
...

Update the php.ini file to solve incorrect expire date for cache control in nginx /etc/php/7.2/cli/php.ini

Run the benchmark

Replace scale with the number of users you intended to test with. Replace the *amd64 with *arm64 for JAVA_HOME if you are running on an ARM machine.

docker run --net=host -e JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 --name faban_client zilutian/web-serving:faban-client-amd64 localhost *scale*

The default scale value is 5. If your scale number is large, be sure to monitor the php-fpm log in the server container at /var/log/php7.2-fpm.logand increase the pm.max_children and other settings in /etc/php/7.2/fpm/pool.d/www.confas appropriate.

To change the distribution The results and log can be found at folder /home/cloudsuite/elgg_output/run_number/, which can be configured as outputDir at deploy/run.xml

summary.xml

<benchSummary name="Elgg benchmark" version="1.0">
        <runId>*some_num*</runId>
        <startTime>*some_num*</startTime>
        <endTime>*some_num*</endTime>
        <metric unit="ops/sec">*some_num*</metric>
        <passed>true</passed>
</benchSummary>
<driverSummary name="ElggDriver">
...

detail.xan

Title: Elgg benchmark Detailed Results

Section: Benchmark Information
Name     Value
-----    -------------
RunId    *some_num*


Section: ElggDriver Throughput
Display: Line
Time (s)  BrowsetoElgg  DoLogin  PostSelfWall  AddFriend  Register  Logout  UpdateActivity
--------  ------------  -------  ------------  ---------  --------  ------  --------------
0                 0.03     0.00          0.43       0.03      0.00    0.00            0.10
30                0.13     0.07          0.23       0.07      0.00    0.00            0.10
60                0.07     0.00          0.33       0.07      0.00    0.00            0.10
90                0.03     0.03          0.17       0.10      0.00    0.00            0.07

Tag summary

Content type

Image

Digest

Size

102.7 MB

Last updated

about 7 years ago

docker pull zilutian/web-serving:db-server-arm64-innodb