FreeBSD's shell (bash) performance issue on eBox 3350mx (vortex86mx SoC)

1

I have an ebox 3350mx that acts as a headless home server offering various local services like dnsmasq, atalkd, time machine backups, http, ssh, etc.

I have installed FreeBSD 9.0. The main hd (ada0) is an external SD card. The specs are 512 MB RAM and PMX-1000/Vortex86MX processor at 1Ghz.

The problem is that it's slow when operating with it. I came through a couple of modifications to make it 'run' faster but the huge pain is the lack a smooth shell prompt.

Tasks like listing directories, editing files with vim, reading files with cat, etc. Have become outrageously annoying.

I'm trying to figure out what is happening. To make things worst, I'm currently online because of ISP's cable problems, they will fix this apparently tomorrow.

I managed to get some speed by, stopping 'sendmail': I've reached 480 MB of Free Memory from merely 12 MB. Apparently sendmail was acting strange which kept the machine slow.

I switched off PAM and useDNS from sshd_config and stopped almost every service. Even pflogd and pf. Most of them, apart from sendmail and sshd_config, did a small but perceptible difference. However, my login prompt still runs like a broken-car. First time I issue 'uptime' I get normal responsiveness second time I issue the command - like 1 second later - I need to wait 15 seconds or hit 'enter' before I get anything on the screen. Some times hitting 'enter' works, as if the tty did not deliver, some times even that doesn't work it's like if i/o doesn't work ... but I get no i/o errors at all.

I'm kinda desperate because I don't know from where to start looking... The post on the FreeBSD forums offers some cmd results if you care to look.

Any thoughts on how to turn the shell's responsiveness to 'normal' is welcomed.

UPDATE:

Here is the disk info:

[user@comodino ~]$ dmesg |grep -i ada
ada0 at ata2 bus 0 scbus0 target 0 lun 0
ada0: <SD RDC SD-IDE HOST CONTROLLER 01000000> ATA-6 device
ada0: 33.300MB/s transfers (UDMA2, PIO 512bytes)
ada0: 15399MB (31537152 512 byte sectors: 16H 63S/T 31286C)
ada0: Previously was known as ad4
Trying to mount root from ufs:/dev/ada0p2 [rw]...

I thought so too that might be an I/O. My card is 16 GB ADATA class 10.

Here is my iostat:

[user@comodino ~]$ iostat
tty            ada0            pass0             cpu
tin  tout  KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
  0     1 24.03   0  0.00   0.00   0  0.00   0  0  0  0 100

I'm doing some test with bonnie++ (http://www.coker.com.au/bonnie++/) now. I'll report the result asap. Thanks for the reply Manoli :-)

update: Here are the results from

[atma@comodino ~]$ bonnie++
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.03e       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine            Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
comodino             1G  4156  24  4591   8  2993   7 14869  88 21277  27 100.8   2
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
             16  2804  58 10449  98  6559  88  2997  61 10711  99  4418  58    comodino,1G,4156,24,4591,8,2993,7,14869,88,21277,27,100.8,2,16,2804,58,10449,98,6559,88,2997,61,10711,99,4418,58

Now I must decode the results :-P

atmosx

Posted 2012-09-09T15:40:42.320

Reputation: 174

Answers

2

Where are /var and /tmp? With SD systems I like to map /tmp -> /var/tmp and make /var a RAM-disk. The following options in /etc/rc.conf will setup a 64MB /var automatically on boot. You still need to remove /tmp and make it a symlink.

# SD Card boot, RAM-Disk /var
varmfs="YES"            # Set to YES to always create an mfs /var, NO to never
varsize="64m"           # Size of mfs /var if created
varmfs_flags=""         # Extra mount options for the mfs /var
populate_var="YES"      # Set to YES to always (re)populate /var, NO to never
cleanvar_enable="NO"    # Clean the /var directory

Chris S

Posted 2012-09-09T15:40:42.320

Reputation: 5 907

Oddly my /var directory is 181 MB currently. I should check what's in, you think 64m are enough? Is it safe to set 'noatime' to var mount options? – atmosx – 2012-09-10T08:41:16.223

I suppose it depends on what's in there, 181MB seems darn big; likely log files? The /var RAM-Disk on my routers is set to 8MB, my home server without the logs and db files (which I don't keep in check, but should) is 36MB. 64MB seemed like a good number, but YMMV. – Chris S – 2012-09-10T13:15:11.903

du -sch /var/db/portsnap/ -> 132 MB ... that's why. Are you on FreeBSD? I could change portstnap's db directory, but thing is that now everything works fine :-) – atmosx – 2012-09-10T21:19:59.753

The routers where there at 8MB /vars don't run portsnap or any update tools, I deploy whole images to those devices to upgrade them. You can create a /usr/portsnap and symlink /var/db/portsnap -> /usr/portsnap or something similar too. No "moving" the directory from portsnap's perspective. Yes, I'm running FreeBSD 8.0 to 10.0 on a variety of devices. – Chris S – 2012-09-10T22:43:05.210

Nice, the problem now is mostly solved. It had something to do with internet connectivity, not sure why bash so affected so much. Didn't use varfs yet but I'll give it try. thanks for your time and hints – atmosx – 2012-09-11T10:48:35.783

1

It probably isn't shell responsiveness, but a very low disk throughput. As a starting point examine dmesg to see what transfer mode your SD card uses:

You are looking for something like this:

ada0: ATA-8 SATA 2.x device ada0: 150.000MB/s transfers (SATA, UDMA5, PIO 8192bytes)

Probably the SD card or the controller is too slow, SD cards come at different speeds - known as speed classes. Ideally you would use a class 6 or higher for an OS disk.

There are a few optimizations that can be done though, like disabling unnecessary logging and file modification times (use noatime in mount options in fstab).

Manolis

Posted 2012-09-09T15:40:42.320

Reputation:

I'd never use less than a Class 10 for the OS disk. I've got a 25MBps SD for one of my FreeBSD servers and even that is laggy as access times are pretty substantial on most SD cards/controllers. – Chris S – 2012-09-09T22:39:59.980

So if the problem is the controller, then there's no hope and this device is probably not the right one to perform operation on it. You just set-it-and-leave-it... – atmosx – 2012-09-10T08:35:25.810