Will someone give me some suggestions for tuning a low power consumption server? Much appreciated!


#1

The hardware of the server is limited: a Seagate Goflex Home (with a kirkwood ARM v5 CPU up to 1.2 GHz, 128M RAM and a SATA HDD), ArchLinuxARM is installed as the OS. This server is now holding a samba server, a timemachine server and of course, the owncloud server.The owncloud is running on lighttpd+php-fpm+mariadb, all softs are updated. Server is connected to a computer with Gb LAN, and the transfer between the computer and the samba server is good, it reaches 20MB/S+, so for so good. However, things turns down when it comes to Owncloud. It transfers big files at 2MB/S or so, and even worse when it synchronizes lots of small files (both MAC and Windows platform). Moreover, once I restarted my client computer, the synchronize software will check all the files under my sync path and it takes around 20 minutes, that's a little bit too long when compared to other clients such as dropbox (BTW: the client is running on windows 10, with a Xeon 1230 v2 CPU, 8G RAM). I know the server hardware may be the limitation, I just want to figure out whether there's a possiblity to improve it a little bit?

Steps to reproduce
1. A power-effeciency server.
2. Newest archlinux arm is used as the OS.
3. Owncloud runs on lighttpd, php-fpm and mariadb (with neccessary dependencies: php, php-cgi)
4. Opcache and apcu are enabled.
5. innodb_flush_log_at_trx_commit = 2 and innodb_max_dirty_pages_pct = 90 are set in Mysql.
6. Connection is forced to use HTTPS.

Expected behaviour
Can the transfer speed reach or somehow close to that of the samba server?

Actual behaviour
It transfers files at 1/10 of the speed of the samba server.

Server configuration
Operating system: ArchLinux ARM (build 4.4.34-1)
Web server: lighttpd
Database: Mariadb
PHP version: 7.0.13
ownCloud version (see ownCloud admin page): 9.1.2
Updated from an older ownCloud or fresh install: fresh install
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption): None

ownCloud log (data/owncloud.log)

Please paste possible errors in the following code block, see https://central.owncloud.org/t/how-to-find-webserver-or-oc-logfile-enable-php-logfile/808 for more info
No new error log

Integrity status for oC9+

No errors have been found.

#2

While I haven't tested owncloud on such step, I recommend you to check your server's memory usage while running owncloud. 128MB maybe too small, if swap is involved, performance will degrade pretty much (especially on devices like yours).


#3

Gotcha! I was doubting whether the memory size should be the one to blame, now I get another positive answer on this! The free memory is only 4M or so, and it uses the swap for around 120M. Yes, it might be the problem of the memory~ Then no way to solve it :frowning:


#4

if you want to reduce everything to an acceptable range, I'd suggest to run "mysqltuner" or similar scripts.

you can also limit the http-sessions in apache, as far as i can remember it was "MaxRequestWorkers XX", where xx is an integer-number (id say use 10 or even less).


#5

Thanks. But I'm not using the Apache, I'm using lighttpd to support http and https, and I have limited the php-fpm to 3 children, which is the minimal. The memory is the problem. I'm considering syncthing for the server now.


#6

sadly ive overseen this point, sorry for that.

nonetheless, you can limit php's (and php-cli, /etc/php/7.0/apache2/php.ini) memory usage by adjusting the following setting:

memory_limit = 32M; value is in MegaBytes (or X-Bytes)

and of course by disabling all unecessary stuff like mods and stuff :wink:

otherwise there's maybe an improvement in your server-bios to be done? overclocking (etc)?


#7

Please note that it is strongly discouraged (and even unsupported) to run ownCloud on lighttpd for the reasons discussed here:

Please consider to move to either Apache + mod_php (the only official supported setup) or nginx + php-fpm (community support).


#8

Yes, I've done that.


#9

and, what might be useful as well, is to install archlinux as a minimal installation.

check this thing out here: https://wiki.archlinux.org/index.php/Improving_performance


#10

Oh thank you, I didn't read this. I will read that carefully now.


#11

Btw. some additional notes:

this is a known limitation of ownCloud.

This is highly discouraged to use that https://github.com/owncloud/client/issues/331#issuecomment-195773771

More important here is to use redis-based file locking (see doc.owncloud.org)


#12

Thus syncing lots of small files should be a problem on owncloud, right? Hmm... That's what I really need.


#13

well, ive been using this setting (innodb_flush_log...) for a while, and havent had any issues so far... and yes, I have quite a few installations running.

but nonetheless, always give yourself that worst-case-scenario where you might be in need of any backups.

BACKUP: /var/www/.../owncloud/data + mysqldump + /var/www/.../owncloud/config/config.php, and youre fine :slight_smile:


#14

Yes. There is currently a development ongoing to bundle small files and upload them in one rush:

Seems the plugin / extension is targeted for the next major release 9.2 of ownCloud planned for February next year:


#15

That's so great! I read the documentations, 128M RAM just meets the minimal requirements, so it shall run, but I should not expect a higher performance on it, right? BTW, I only use this myself, so it's a server with only one user, will it be good for that?


#16

Thank you so much! I read that thread saying that setting innodb_flush_log_at_trx_commit = 2 will tell MySQL to write the log every second rather that real time, does that mean I still need to back up those files?


#17

never ever ask if backups are useful ... :smile:

even when your chances to have a super-gau (or in english: MCA - maximum credible accident) are going towards 0%, you're always glad to have it when you need it... trust me :stuck_out_tongue_winking_eye:


#18

Gotcha! That's true! I will remeber that and execute a backup periodically


#19

Well, you could swap out the existing disk for a SSD. That would make the memory latency on par with your installed RAM. This assumes of course that you increase your swap space significantly. The other option is to install the SSD in addition to your existing HD, and reconfigure your OS to use the SSD as swap.
I am also assuming that if you add another disk (e.g. a SSD) that it would be through the SATA connection and NOT a USB port. Adding it to a USB port would make the situation much worse.
Good luck
J


#20

Thank you for your idea! I will try that, too!