Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Unhappy with user share performance (would a swap file help?)

Featured Replies

User shares annoy me to tears but I really want to use them.  On my machine performance is terrible.  On same drive though, performance on the disk share is great.

 

It seems as though the more things you put in a user share, the worse its performance becomes.  Not only that, but having a mapped drive to a user share actually seems to degrade the performance of my Windows XP machine overall!!

 

Has anyone else experienced this same problem, and came up with a solution for it? 

 

Last week, I was having an issue where I couldn't get the array to start anymore.  Tom was kind enough to take a personal interest in my problem and worked with me quite a bit over email.  Essentially, deleting the share.cfg file solved my problem.  After deleting it, the array was able to start fine, and all files were speedily accessbiel through the disk shares. 

 

Originally, I had 4 or 5 users shares.  1 of the user shares probably easily had hundreds of thousands of files in it, and a very complicated directory structure.  As I didn't want to worry about each individual disks capacity, rather wanting to worry about the array's as a whole capacity, I set all the shares to high-water, with a split level of 999. 

 

Tom's explanation for why I was having difficulty starting the array, was that I may have been running out of memory. 

 

So, this time I decided to do things more intelligently.  I moved the files and folders around the way I wanted them to be, in the disk shares.  Then I pulled a fresh share.cfg from the zip archive, and deleted all the original share files that existed on my flash.

 

Initially everything worked great.  I was able to create new user shares, and move files from other locations on my network to them with speed.  I set the share level to 5, as I know 999 was overkill.

 

The more stuff I copy to my new user shares, the slower everything gets.  This is killing me.  If I wanted to be limited to only using something like a disk share, I'd have just bought a bunch of 2 disk NAS's that could be configured with RAID1.  It would have been a lot simpler than all this, and I wouldn't have diluted myself with visions of something nicer. 

 

 

 

  • Author

I've been digging deeply into the forums for the past few hours.  Appearantly even the ability to write to users shares is a pretty new feature.  With older versions of unraid, everyone said to just not do it.

 

I've read bits and pieces in some posts about creating a swap disk.  But no one has given a step by step on how to do this.  I've got old drives I wasn't planning on using with Unraid, but I think would work great for this purpose.  As I am a complete Linux Noob.  If some kind soul would be willing to post a detailed step by step, on how to implement this, that a 1st grader could understand, I would be most appreciative.

 

I think this might clear up my problems.  And allow me to user unraid the way I want to. 

The following script creates a SWAPFILE and turns it on.

 

Currently it is on /boot which could age your flash prematurely.

However it works, this is something we did on our Roku soundbridges when they only had 64MB of memory.

 

There are two configurable variables as the top.

The swapfile (and location).

and the size in blocks. (64MB right now).

 

Alter as needed and add to our go script.

 

Keep in mind, if you put the swap file on a managed disk by unraid, this may prevent that disk from spinning down.

 

If you would rather use a real swap partition let me know.

The process is fairly simple.

 

I can't say this will help with the situation, I wrote this a few weeks ago merely as an exercise

as I was planning to take some of the basic unraid rootimage and port it over to another low memory machine for use with a firewall.

 

 

::::::::::::::
./rc.swap
::::::::::::::
#!/bin/sh 

if [ ${DEBUG:=0} -gt 0 ]
   then set -x -v
fi


P=${0##*/}              # basename of program
R=${0%%$P}              # dirname of program

RCFILE=$0
SWAPFILE=/boot/unraid.swapfile
SWAPSIZE=65536

# CFFILE overrides Entries
CFFILE=/boot/config/${P}.conf

if [ -x ${CFFILE} ] 
   then . ${CFFILE}
fi

start() {
    if [[ -z "${SWAPSIZE}" || -z "${SWAPFILE}" ]]
       then echo "$0: cannot setup swap file. settings not in conf: ${CFFILE}"
            return 1
    fi

    # make the swapfile
    if [ ! -r ${SWAPFILE} ]; then
        echo "Making Swapfile: ${SWAPFILE}"
        dd if=/dev/zero of=${SWAPFILE} bs=1024 count=${SWAPSIZE}
        mkswap ${SWAPFILE}
    else 
        echo "Using Existing Swapfile: ${SWAPFILE}"
    fi

    # setup loops for swapfile and SDK
    LODEV=`losetup -f`
    losetup ${LODEV} ${SWAPFILE}
    swapon -v ${LODEV}
    cat /proc/swaps
  
    return;

    if ! grep ${RCFILE} /etc/rc.d/rc.local_shutdown >/dev/null 2>&1
       then cat <<-EOF >> /etc/rc.d/rc.local_shutdown

if [ -x ${RCFILE} ]
   then ${RCFILE} stop 
fi

if [ -x $0 ]
   then $0 stop
fi

EOF
    fi

  if [ ! -x /etc/rc.d/rc.local_shutdown ]
     then chmod u+x /etc/rc.d/rc.local_shutdown
  fi

}

stop() {
  swapoff -a 
}



# How to call it.
case "$1" in
    start)   start ;;
    stop)    stop ;;
    status)  cat /proc/swaps;;
    restart) stop; sleep 1; start;;
    *)       echo "Usage: $0 {start|stop|restart}";;
esac

 

 

I personally have held off from using user shares.

 

I want the better performance of not using them, and I have read a steady stream of people having minor annoyances (e.g., not getting updated when files are moved).  I know that this is a new feature and have just decided to wait for it to become a little more mature.

 

I have had some success at adding shares Samba.  For example, my MP3 collection (located on a single disk), is shared as "MP3" read only.  This is not hard to configure (not hard with Joe L's assistance that is - Thanks Joe!).  When I decide to implement user shares, I can name the share "MP3" and my iTunes won't know the difference.

 

The only thing I am really missing is user security.

 

  • Author

Thank you Weebotech.  I think I would rather use a real swap partition.  I don't want to put it on the flash, or on one of the array drives.  Specifically, I have an old 36 gig raptor drive not doing anything, which I believe might be perfect.  Its still a nice functioning drive, but too small to be useful anymore, and the 10,000 rpm should be good for a swap. 

The instructions in the first link in the prior post are exactly what you need.

 

Install your 36 gig "swap" drive.  Before installation, write down its serial number and model number.

 

You need to determine its associated device.  Easiest way is to stop the unRaid array, click on the devices tab in the interface and you should see it listed in the drop-down-list.  The "device" will be shown there in parentheses.  It will be sd? or hd? (where the ? is a,b,c,d,e,f,g...)  Do not assign it to any slot in the unRaid array, just make a note of its device.

 

let's assume you see "(sdk)" on the line for your raptor drive.  For the commands shown in the instructions WeboTech linked to, you would then use /dev/sdk for the fdisk command.  The swap partition on it you create using the fdisk command would then be /dev/sdk1

 

Oh one more thing... since the file "/etc/fstab" is only in memory on our unRaid servers, editing it will only last until you reboot.  In addition to editing it, add a line like this (using the correct disk partition) to your "go" script:

echo "/dev/sdk1 swap swap default 0 0" >>/dev/fstab

 

Once that line is in the fstab file, you can issue the swapon and swapoff commands as needed to enable or disable the swap partition.

 

 

Thanks for adding Joe...

After some thought.. Might be better if we used labels..

This way if drives shift, the swap drive's designation will not need to be know.

 

Thoughts?

 

 

Below is a short script that finds the correct disk by its serial number.

 

Not sure if it is easy to add a LABEL to a swap partition, so I did it by serial number as shown when you manually do a "ls -l /dev/disk/by-id" command.

 

Joe L.

 

#!/bin/bash

# start swap disk, identified by its serial number.  This assumes that the swap partition is the first partition on the disk

# and that the disk is partition is marked as a "swap partition" type. 

# (Use fdisk, as described in link to set this up.  Only needs to be done once)

 

# Put your drive's serial number here...

drive_serial_number="B60BPPBH"

drive_id=`ls -l /dev/disk/by-id | grep "$drive_serial_number" | sed 1q | awk '{

        printf "/dev/%s", substr($11, 7, length($11) - 1)

}'`

 

mkswap -c /dev/${drive_id}1

swapon /dev/${drive_id}1

  • Author

I'm the idea man today.  For some reason the onboard IDE controller on the motherboard wouldn't recognize any of my IDE drives.  Not sure why.  But, thats not the point of this post. 

 

I got an idea!

 

I have a Promise TX2 Card that I used in an old server. 

 

http://www.promise.com/product/product_detail_eng.asp?segment=RAID%20HBAs&product_id=8

 

I thought, let me see if the drives are recognized with it.  Sure enough they were, now I"m confused though.  The Promise TX2 Card is a hardware raid controller.  There is no option in the cards bios to set it up as JBOD.  Only span, mirror and stripe.  Interestingly enough, the unraid web page mngt, seems to recognize both drives independantly, regardless of whether I chose span, mirror or strip while setting things up.  Why would that be?  If its hardware raid, shouldn't the OS see the drives involved as a single entity?  Granted I'm used to Windows Systems, but why should that work differently in a Linux based system? 

 

I have a sinking feeling that something is very not right here. 

 

As a side question.  If I get unraid to see both drives as one, could I stripe them and put the swap on that for a performance boost? 

  • Author

Is it true that the largest a swap file can be is 2 gigs?  Could I create multiple swap files?

Is it true that the largest a swap file can be is 2 gigs?  Could I create multiple swap files?

 

Yes, and Yes...

 

swap is generally 1.5 to 2x ram, but with Linux it's not always needed to be that much.

I have never had a 2G swap file ever fill up. (or even get close to that matter)

 

Also, It's usually best to put swap on the outside of the disk (first few paritions) so that it gets the highest transfer rate possible.

 

 

 

 

 

 

I have never been a fan of the "1.5X to 2X" method, since there is an inverse relationship between physical and virtual memory, not direct.  Using the direct method, if I have 64MB of physical RAM I would only need 128MB of swap - I don't think so.  The method I have employed is "Figure out the largest amount of addressable memory I need and subtract out physical RAM.  So if I need 2GB and have 512MB of RAM, I would set it to 1.5GB.

 

Since figuring out the max addressable memory is difficult, I often simplify it to: set swap to as big as I can make it.

 

 

Bill

Initially everything worked great.  I was able to create new user shares, and move files from other locations on my network to them with speed.  I set the share level to 5, as I know 999 was overkill.

Probably split level 5 overkill as well.  You want to use a split level of 1 or maybe 2 or possibly 3 depending on your share organization and what you are storing in the shares.  If you post your top 1 or 2 directories for each share, we can provide more suggestions.

 

Also, please see my reply at the end of this thread regarding user shares.

 

The more stuff I copy to my new user shares, the slower everything gets.  This is killing me.  If I wanted to be limited to only using something like a disk share, I'd have just bought a bunch of 2 disk NAS's that could be configured with RAID1.  It would have been a lot simpler than all this, and I wouldn't have diluted myself with visions of something nicer. 

 

What is getting slower?

 

Also, adding swap space is not going to improve things except to let you set a deeper split level and not run out of memory (ie, won't improve performance - in fact might make it worse).

 

If you want to wait a couple days, we'll be releasing 4.3-beta1 which can support up to 4GB main memory - so you can just plug in more DRAM and not worry about it  :)

I have never been a fan of the "1.5X to 2X" method, since there is an inverse relationship between physical and virtual memory, not direct.  Using the direct method, if I have 64MB of physical RAM I would only need 128MB of swap - I don't think so. 

Bill

 

it all depends on the system employed. I remember days long ago, A process allocated swap space based on it's footprint in memory.

Therefore it required at least 1X memory for what ever ram you had so it could get mapped into swap when needed.

Then extra swap to allow the system to use more memory then is readily available in ram.

 

These days the requirements are not as stringent.

For example on my 4G system I only have 2G of swap space because the only things that get swapped out are unused older pages.

 

Now on Solaris you can have tmpfs and using swap, therefore you would want as big of swap as possible.

 

It all depends on the system needs.

 

I agree with Tom that adding swap space on unRaid probably wont improve performance, and may hamper it.

  • Author

I truly appreciate all the responses from Tom and from WeeboTech.

 

It seems as though no one thinks swap will help me.  So, I guess I'll give up on that.  I'm very excited to hear that 4.3 Beta1 is going to support 4 gigs of ram.  My motherboard can support up to 8 gigs.  Is there any chance of a future version supporting that much?  The only reason I ask is because right now I have 1 gig in the form of 2 512's.  If 4 gigs will be the magic number for a while, I'll probably purchase a 2 1gig, 2gig pack.  But, if there is any chance for more than 4 gigs in the future.  I'm talking years from now.  Then I might get a 2 2gig, 4gig pack. 

 

Additionally, I've been doing some research online about a supposed problem with XP and Samba sending ack packets properly.  Symptoms are that the xp machine is very slow connecting to the samba server.  But, Linux is intelligent to know that it needs to change the timing for receipt of these packets.  When it does that, speed is OK for a while.

 

I wonder if this is my problem now?  It would kinda make sense.  Cause even when I connect to disk shares its initially slow.  When I connect to the flash share its initially slow.  When I'm connected to a user share browsing files, the speed is fine, but its when another disk has to be activated to continue browsing that I see a speed slow down as well, and the disk has not spun down. 

 

What does everyone think?  Is this even a possibility?

Then I might get a 2 2gig, 4gig pack.

 

I would go with this (if it were me).

maybe use the 512's somewhere else, leaving room in the future for expansion on this machine.

The price point on 4G packs  is good and rebates abound on newegg.com.

 

  • Author

Doing what this post said.

 

http://lime-technology.com/forum/index.php?topic=1247

 

Improved my setups performance like 1000%.  Its still not quite as fast as I could hope for in my wildest dreams, but its so much better, I don't regret my unraid purchase anymore. 

Doing what this post said.

 

http://lime-technology.com/forum/index.php?topic=1247

 

Improved my setups performance like 1000%.  Its still not quite as fast as I could hope for in my wildest dreams, but its so much better, I don't regret my unraid purchase anymore. 

 

Oh my god. I didn't see this original post. I can't describe how much faster my system now responses. Thanks for bringing this link up.

 

Regards

Harald

 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.