Likely performance gains after setting up a swap partition on an Archer C7

Hi all,

After reading and I have more questions than I originally started with, so here goes:

  1. Would it be safe to setup a swap partition on an already-configured extroot drive? The drive is a USB external HDD (not flash) and so I'm hoping the advice in the first link above about "grind[ing] it into the ground quickly" does not apply here.
  2. If the answer to 1. is "yes", what kind of performance gains could I expect to acheive by doing so? The router already has 128MB of RAM which I know is a fairly decent amount for a consumer-level router, but I think I still need on to find out why.
  3. What is this "SQM" feature that the second link above constantly mentions? What kind of internet performance gains could I expect to achieve by enabling it? My connection is 50mbps down/5mbps up so it seems as though I shouldn't reach the bottlenecks described in that link, as my connections won't even go that fast to begin with!

While 3. is just a question that the linked thread has raised in my mind, 1. and 2. relate to a single core goal of mine, which is to enable LAN-wide ad blocking on the router itself, rather than having to setup separate browser add ons or otherwise-unnecessary apps on every device that I use.

To this end I have tried to append a huge (31 MB) list of domains to block on to /etc/hosts, redirecting them all to, but this doesn't work, presumably because the file is too big to be loaded by dnsmasq. I've tried to confirm this by scouring the output from logread, but I'm too inexperienced with the Linux CLI to really understand what any of the messages mean. Is there a way to do any of this through the LuCI web interface?

I've tried using the adblock package to facilitate this but it also seemed too difficult to configure, even though its author touts it as a "zero config" package. The lack of clear descriptions in LuCI of what each and every blocklist actually blocks is a PITA, and I couldn't get any of them to load anyway, with the only apparent reason for that being the single word "error" next to "Adblock Status" in Services > Adblock > Runtime Information. I know I could dig deeper with a logread etc. but once again, most of those messages mean nothing to me and I don't have the time nor patience to spend hours debugging the problem.

Since I have used the hosts file in Windows for this purpose for many years, I was hoping that my goal would be achievable through the same method in OpenWRT as well. Please LMK whether I'm barking up the wrong tree or there is merit to the idea. Any other suggestions of how to achieve my goal without extra non-OpenWRT software would also be greatly appreciated. MTIA! :smiley:

SQM or Smart Queue Management would almost certainly be of benefit for you, especially with your "slower" (and 50/5 isn't that bad - I'm on 40/2!) ISP speed, because the CPU in your Archer C7 can handle somewhere around ~135 Mb/s running SQM on your WAN interface (do not set up SQM on your LAN interface - if you do that, things will slow to a crawl! Don't ask how I know).

Speaking from my own experience with a 40/2 DSL ISP, using layer CAKE SQM has reduced buffer bloat (improved latency) on my upload from horrid to very good, and also helped download. This is especially helpful in not having issues with things like stuttering on a VOIP phone, but also helps level the load between various use demands on your internet connection.

This speed test does a decent job of telling you if you have buffer bloat issues that SQM would help:

The trick to setting up SQM is to throttle your up and down speed slightly lower than the maximum speed of your ISP line in the SQM settings, so the router can use this reserved speed margin to manage the load on your internet WAN interface. ~5% lower than your maximum speed is a good place to start. I found my buffer bloat was so bad, that my actual line speeds were higher than testing showed with no SQM, so I experimented raising speeds set in SQM until my speed test results started degrading to find the "sweet spot".

I can't say enough about how well layer CAKE SQM has worked for me. While I was working remotely from home, my son decided to torrent download a virtual reality game from STEAM, seeding it to millions of his best friends for simultaneous upload in the process - it was a 50 Gigabyte download-while others were streaming Netflix n the house. I noticed a little bit of slow down, but remote access to work servers more or less continued smoothly despite this demand in the background on my 40/2 line, including using our VOIP line for conference calls.

SQM is good stuff. Turn it on.


Wow, sounds like the best improvement in I.T. since fibre optic internet delivery became widespread! Although much of Australia is still on FTTN, I'm one of the lucky ones (thanks Dad for starting that business 40 years ago and convincing Telstra that we absolutely must have FTTP :smiley:).

Please excuse the tangent from my original questions, but just out of curiosity, where on Earth are people like you still being limited to 40/2?!?! Even though I consider myself lucky compared to most Aussies, I still envy my American gamer friends who are paying less for 10x faster internet!

Anyway thanks for the awesome advice; I'll definitely spend some time looking into SQM and trying to configure it, although the amount of fiddling required seems like it may be too much effort for my current time constraints (I work as a web developer ~70 hours a week and prefer to spend what little downtime I get is mentally exhausting enough!).

1 Like

LOL, I hale from America. For my use case, I don't make use of much more than 40/2 (managed with SQM), so I switch ISP annually to chase the lowest cost "introductory rate" for "new customers." This is a dry year - we're on the slower (but a little less expensive) bonded VDSL2 ISP. For our use though, we barely notice a difference from 200/20 cable ISP. Gigabit is an option too, but at double to triple the cost for capacity we neither need nor would use, we're passing for now.

1.- I think a mechanical HDD should be enough for a swap file, it should be faster than a usb flash drive.
2.- Using adblock you can fill the ram pretty quickly specially if you use big block lists, a swap file should help in this case. I don't know about performance, but at least it will help the router keep running. Btw, the default memory consumption in the latest openwrt release for ath79 is a bit high, so again be careful adding big block lists to adblock.
3.- I can live without adblock, but SQM is a must, when you configure it right, all the internet stuff feels better, if you live in a country with high latency connections you should try SQM.
If you want all (SQM+adblock+a lot of lists) I would search for a powerful device.

fwiw, i'd disagree with that... YMMV, but both adblocks for me have been super easy to setup on a fundamental level. I do have unlimited storage and ram-ish tho'...

otherwise... to test... don't bother with a partition of its going to be a pain to setup... just use a file...

dd if=/dev/zero of=$SWAPFILE bs=1M count=$SWAPSIZE
mkswap $SWAPFILE
swapon $SWAPFILE

#uci -q delete fstab.swap
#uci set fstab.swap="swap"
#uci set fstab.swap.device="$SWAPFILE"
#uci commit fstab
#/etc/init.d/fstab boot

TEST being the operable word. ( sqm wont benefit - may help you to load big adblock lists but overall lookups take too big of a hit)...

try ask in the adblock thread about it?

1 Like

I think yes it should be safe. Note you can also use a paging file instead of a paging partition. (We call this swapping/swap partition even though Linux never swapped, but always paged, but forgive my pedantry :wink: )

So I use swap on a USB2 stick on a 64MB ath79 device, and I have not experienced any "performance" gain, but the reason to create the swap was not to speed things up, but to reduce unscheduled downtime by reducing the risk to have the out-of-memory (OOM) killer make the router unusable or even cause unrequested reboots. That seems to work reasonably well, but I have not recently re-evaluated whether no-swap would not be equally stable nowadays...
Please note, that not all kernel memory can be swapped out, so even with a paging partition/file of large size with lots of empty space OOM can still happen.

I am biased, but I would recommend to try this, have a look at the overview and the details. Especially the recommendations in the "sing and dance" section... If you have questions, just open a new thread here in the forum (to avoid hiding SQM related content behind a swap-related topic).

I doubt that you really get any performance gains from swap. HDD would be slower tha RAM in any case.

The basic thing would be to limit the used services to an amount that your hardware tolerates.

Note that if you apply huge blockfiles for adblock, those rules need to be evaluated at each DNS query. That can slow down things quite a lot.

My advice:

  • naturally use SQM to provice QoS tools for your limited internet connection of 50/5 Mbps. (Note that the limited upload bandwidth (like your 5 Mbps) is usually the crucial item, where things get stuck)
  • use only a limited amount of blocklists in adblock. The goal should be to not block all possible ads, malware, bitcoin mining etc. in the world, but the ads that hit the sites that you visit frequently.

Thanks everyone for the awesome advice! I'll definitely look into SQM and creating a swap partition over the Easter weekend. Not allowed to work or go out anyway so why not? :stuck_out_tongue: