[ODROID-C1] WebServer Host Apache + Mysql

Moderators: mdrjr, odroid

[ODROID-C1] WebServer Host Apache + Mysql

Unread postby alexgoaga » Fri Jan 22, 2016 4:46 pm

Hey Guys, I have a question about the poor performance of ODROID-C1 mini-pc.

Last night I made a "play-test" on a Web Server Apache + MySQL hosted by ODROID-C1 running on a 32 Gb Sandisk SD card and I was very extremely disappointed to notice that after more than 3+ players running the site in the same time, a incredible lag of 10 + seconds until a response was present. The first time I hoped that the resource consumed by Apache was more than expected but when i accessed the resource monitor to see the consumption of ram memory i saw 340 mb used ,and the rest ~ 620Mb free.

Note that i have reduced the video quality to 16 bit , 800 x 600 just to have more performance .

On the ODROID-C1 i run ODROBIAN, this was the best performance that i noticed vs android build or other linux build ( maybe i am wrong ?)

I hope that somehow im making a mistake somewhere that is causing my server to lag.
On the ODROBIAN OS i have only installed : apache + mysql + ftp connection ( no other needs like sound or bluetooth etc )

But, here is my problem , tested vs a pc with the following performance
Single Core CPU of 1.7Ghz Socket 478 ( oldies but goldies )
1 Gb ram DDR 1 frequency 200 mhz
Running OS : Windows XP SP 2;
HDD : USB kingston with 20 mb / read , 18 mb / write

And still DOES NOT LAG until more that 12 players ( tested with 20 friends ) spams all the options in the site.

Where is the problem? Can somebody tell me if i'm doing something wrong ? I'm very disappointed of odroid

Thank you for your time ,
Alex
alexgoaga
 
Posts: 7
Joined: Tue Oct 13, 2015 1:55 am
languages_spoken: english
ODROIDs: C1

Re: [ODROID-C1] WebServer Host Apache + Mysql

Unread postby meveric » Fri Jan 22, 2016 6:39 pm

First of all, if you use it as a Server for Apache and MySQL you shouldn't use a Desktop image at all but rather a Server image with no desktop environment.
It's also advices to deactivate VPU and HDMI output in boot.ini so you get rid of the video configuration completely and get about 120 MB extra memory or so.

You might want to monitor the entire system not just memory. A "easy" way to do this is using "htop" it shows memory usage as well as CPU usage.
So you can see what causes the slow downs. The C1 has a rather "weak" CPU. So depending on the software you're running (PHP can cause a lot of CPU load) this can be too much for a device such as the C1.
Overclocking "might" help but not if the gap between current result and wanted result is too big.
Overclocking won't get you more than 20~30% more performance (if at all - 30% more than 3 users equals 4 users).

There are also ways to tweak apache, mysql and php to better use the devices capabilities.
For example loading the mysql database (or just the index) into memory can greatly reduce request times on the database.

Besides that, SD cards can be slow, especially if there are a lot of read/write operations. So if your software is constantly writing data to the SD card, this can slow down the entire system and you might want to consider putting your database on a external storage, either in network, or an attached USB drive (no flash drive but real HDD).
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 7945
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1

Re: [ODROID-C1] WebServer Host Apache + Mysql

Unread postby alexgoaga » Fri Jan 22, 2016 7:02 pm

Can you recommend any Server OS image with no desktop environment with a performance higher enough to sustain a php + apache + mysql server? Also it's any tutorial about how to install all of them without problems ( I do not know well linux, that's why I used a desktop environment )

About the loading the mysql database (or just the index) into memory can greatly reduce request times on the database. Where i can find a tutorial or some explication about this module ?

Thank you,
Alex
alexgoaga
 
Posts: 7
Joined: Tue Oct 13, 2015 1:55 am
languages_spoken: english
ODROIDs: C1

Re: [ODROID-C1] WebServer Host Apache + Mysql

Unread postby meveric » Fri Jan 22, 2016 10:12 pm

alexgoaga wrote:Can you recommend any Server OS image with no desktop environment with a performance higher enough to sustain a php + apache + mysql server? Also it's any tutorial about how to install all of them without problems ( I do not know well linux, that's why I used a desktop environment )

Currently there are three "ready-to-use" images available that I know of (could be more of which I'm not aware of)
  1. XeoSal's Odroibian Vanilla image.
    I can't say much about that image you have to talk with XeoSal about it. But generally it should be a server image and if you disable VPU and HDMI output it should be fine.
  2. An Ubuntu 14.04 LTS Server image provided by me
    Default User/Password is linaro/linaro (due to the fact it was originally build from a linaro image, but has nothing to do with linaro any longer)
    It's build for higher security disabling things I didn't like on the HK images, such as auto login of user root on debug UART console, or password login for user root and such things.
    Although the image is a little older, it should still work fine and can updated to newest Kernels.
    VPU is already disabled, HDMI is still on but not really necessary.
  3. A minimal Debian Jessie image also provided by me.
    It's very minimalistic and is a nearly untouched Debian Bootstrap image.
I can support you with the last two images. For the first one you have to talk to XeoSal.

alexgoaga wrote:About the loading the mysql database (or just the index) into memory can greatly reduce request times on the database. Where i can find a tutorial or some explication about this module ?

Thank you,
Alex

There is no easy answer to that. If you search on google you will find many article about how to configure mysql to efficiently use RAM.
Problem is, that the RAM of the C1 is limited to ~900MB so depending on the size of your database it will not fit into the RAM.
Besides that your apache and php is also using a certain amount of RAM which can vary depending on the tasks it needs to perform. I've seen apache servers that used several GB of RAM as well.
And php scripts that used even more. So it really depends on the software you use.

To configure mysql you need to adjust your my.cnf config file with options like:
Code: Select all
key_buffer
tmp_table_size
join_buffer_size
query_cache_limit
query_cache_size
sort_buffer_size
innodb_buffer_pool_size
innodb_additional_mem_pool_size
innodb_log_buffer_size

It can be rather complicated to find the correct values for these.
And I'm not sure if I can help here with "good" values for a C1.
At work we using server with 192 GB RAM not with 900 MB, that's a huge difference, and makes it much harder to configure a system.

In the end you probably should try to find out what's causing the current problems.
As I said, the capabilities of the C1 is limited in both CPU and RAM, and the software you try to run might not be suitable for a C1 at all.
It might not even work on an XU4 depending on what you are really running.
Even your old PC that you named in the original post should be way faster then a C1 and probably even faster than a XU4.
Although the multiple cores on a C1 and XU4 might provide a better performance then the single core cpu if the tasks can be performed parallel and not serial.
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 7945
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1

Re: [ODROID-C1] WebServer Host Apache + Mysql

Unread postby mrbcast » Fri Jul 07, 2017 2:18 am

I have been running 4 XU4's with ubuntu 14 server image and nginx for webhosting for 3 years solid now. I host 23 sites for my clients and I have a c2 running my sql. They also run icecast for a local radio station that I host for. I haven't had any real lag and the serve time is better than the HP DL 360's I used to use for the same purpose. They make excellent web servers if you use the right software and load balance them. I have no complaints.
mrbcast
 
Posts: 1
Joined: Mon Feb 01, 2016 12:40 pm
languages_spoken: english
ODROIDs: xu4,c1+

Re: [ODROID-C1] WebServer Host Apache + Mysql

Unread postby meveric » Fri Jul 07, 2017 5:47 am

XU4 has more than twice as much available RAM after boot than the C1 has, which makes all the difference ;)
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 7945
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1


Return to General Chat

Who is online

Users browsing this forum: No registered users and 3 guests