User avatar
boomonster
Posts: 80
Joined: Fri May 11, 2018 11:18 pm

My Pi 2 keeps getting slower. Help!

Sat Sep 15, 2018 9:56 pm

Hi,
I have a RPi 2 v 1.1, running Raspbian Stretch.
Anyways, I have used it for a little while, and
the speed of the Pi seems to keep getting slower,
and I am left clueless... :?:

pcmanbob
Posts: 7084
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: My Pi 2 keeps getting slower. Help!

Sat Sep 15, 2018 10:11 pm

To little information for any one to even comment on what might be happening.

we are not mind reader nor do we have crystal balls.

If you want meaningful help then supply meaningful information.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
boomonster
Posts: 80
Joined: Fri May 11, 2018 11:18 pm

Re: My Pi 2 keeps getting slower. Help!

Sat Sep 15, 2018 10:14 pm

What kind of information?
I'm new to the forum.

pcmanbob
Posts: 7084
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: My Pi 2 keeps getting slower. Help!

Sat Sep 15, 2018 10:20 pm

How about for a start.

which OS are you running.

what programs are you running when the pi seems to slow down.

how do you know its slowing down what are the symptoms ( display freezes, keyboard unresponsive, program stops outputting data etc )
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

LTolledo
Posts: 2020
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: My Pi 2 keeps getting slower. Help!

Sat Sep 15, 2018 10:32 pm

boomonster wrote:
Sat Sep 15, 2018 10:14 pm
What kind of information?
I'm new to the forum.
First..... a complete list of hardwares connected to the RPi2B v1.1
microSD size, rating (like Class 2?), age
PSU type and rating (hope its not a phone charger!)
other peripherals

Second.... OS and applications installed and running on the "slow" RPi2B v1.1
Raspbian Stretch (desktop? lite?)
other applications

Third.... on what condition(s) did you "feel" the RPi2B is slow? Slow compared to what?
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

User avatar
boomonster
Posts: 80
Joined: Fri May 11, 2018 11:18 pm

Re: My Pi 2 keeps getting slower. Help!

Sun Sep 16, 2018 12:37 am

Okay. So my Pi 2 is running Raspbian Stretch ( not lite ) ontop of noobs ( I think it is v2.8 ). It has a 2.0 amp power supply running at 5 volts.
As for peripherals, I have a powered USB hub connected, with several USB drives and a Wifi dongle connected ( the USB drive sizes are 512mb,
4gb, 2 16gb USB keys, and 1 32gb). Next, hooked up directly to my pi on a regular basis is my Logitech wireless mouse ( I used to use an old
wired dell mouse), an HP keyboard, and I swap out the last port for a USB microphone or Bluetooth dongle. That's my general peripherals
hooked up.

Next. As for what programs I am using:
When I use scratch 1.4, It seems slower than usual (dragging block chunks around lags QUITE a bit, and old games I made on Raspbian Wheezy lag so badly they are absolutely unplayable). On scratch, my processor never went above 30%, and now it does sometimes while
being slower. Chromium (even when sitting idle) seems to slow things down - Right now as I am writing this message my RPi is lagging
worse than it was then last boot ( I have a small leafpad document open).

Just as a question, would having Full KMS GL enabled slow down my computer?

Next, SD card. Mine has been used for about 2-3 years, it is a class 10 32gb SanDisk Ultra MicroSDHC 1.

Next, what was my Pi slow compared to? Well, back when I just got my USB hub (about 6 months maybe.) , and I and I had about
10 programs less and probably about 10 application libraries/extensions.

Next, Which programs do I have installed? Here are the ones that I installed (not included with the OS.):
gimp, audacity, rafkill, dosbox, qemu, qemu-utils, qemu-command, qemuctl, python-cwiid, pykeyboard(python 2 via pip), blender, earcandy,
gnac, ProjectM pulseaudio, 5 Pulseaudio programs, simplescreenrecorder, soundkonverter,soundconverter,vlc,and mplayer2

I think that gives you enough information. If I do a program cleanse, would this help?

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: My Pi 2 keeps getting slower. Help!

Sun Sep 16, 2018 1:00 am

I would run top or htop and see what programs are using a lot of CPU and/or memory.
Especially watch out for swap usage. Any use of swap will make the RPi unbearably slow.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

LTolledo
Posts: 2020
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: My Pi 2 keeps getting slower. Help!

Sun Sep 16, 2018 1:03 am

Hope you dont mind some additional questions:

When was the last time you did the following?

a. apt update and apt upgrade
b. apt-get clean and apt-get autoremove
c. image backup of your microSD card

Also have you tried, using another microSD card, to install a fresh installation of Raspbian Stretch with Desktop, to compare the speed between a fresh install and your current microSD.

You may also want to check how many task and threads are running in the background (using htop in command line). Too many task tend to slow the RPi
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

LTolledo
Posts: 2020
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: My Pi 2 keeps getting slower. Help!

Sun Sep 16, 2018 10:59 am

klricks wrote:
Sun Sep 16, 2018 1:00 am
Especially watch out for swap usage. Any use of swap will make the RPi unbearably slow.
I noticed this just recently on this RPi3B+ while using chromium with 7 tabs opened. and most specially when Facebook is opened.
before I added the facebook page, I opened htop in terminal
my swap is already at 99MB! the default swap file of raspbian is 100MB.

As am using USB thumbdrive as my boot drive, I tried increasing the swap file size to 500MB.
swapfile usage immediately dropped to zero, but when I changed to one of the tabs in Chromium swapfile usage went up to 40MB.
then I made a new tab for facebook.... and WoW! swap file usage increased to 220MB.

When the swapfile size was 100MB, Raspbian was already crawling, freezing, outright annoying. With the increased swapfile size to 500MB, the symptoms were not present.

Adjusting the swapfile on a microSD boot raspbian will decrease the usable life of the microSD card (leading to a "read only state") so its not advisable.
There are others who have pointed out the benefit of editing the swapfile size, if (and only if) the swapfile is located in a USB HDD
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

User avatar
boomonster
Posts: 80
Joined: Fri May 11, 2018 11:18 pm

Re: My Pi 2 keeps getting slower. Help!

Tue Sep 18, 2018 1:26 am

I checked htop yesterday, and I didn't notice anything especially slow. I haven't checked swap yet, though.
I have updated and upgraded like -maybe 2 weeks ago. But I didn't even know about apt-get clean. I haven't recently
autoremoved, but I should, I guess. I am new, and I only learned the whole thing about bootable images maybe 6 months ago when I started fiddling around with Windows 98 in qemu. So no, I haven't done any image backups.
When I ran htop, there was about 100 threads when I counted all the tasks listed. About swap. I have a 512mb usb key, would it be advisable to use for swap? Crazy how much Chromium uses. So I'll apt-get clean and autoremove,
and if I remove some programs and update+upgrade, my computer should be a happier machine, right?

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: My Pi 2 keeps getting slower. Help!

Tue Sep 18, 2018 1:52 am

boomonster wrote:
Tue Sep 18, 2018 1:26 am
I checked htop yesterday, and I didn't notice anything especially slow. I haven't checked swap yet, though.
I have updated and upgraded like -maybe 2 weeks ago. But I didn't even know about apt-get clean. I haven't recently
autoremoved, but I should, I guess. I am new, and I only learned the whole thing about bootable images maybe 6 months ago when I started fiddling around with Windows 98 in qemu. So no, I haven't done any image backups.
When I ran htop, there was about 100 threads when I counted all the tasks listed. About swap. I have a 512mb usb key, would it be advisable to use for swap? Crazy how much Chromium uses. So I'll apt-get clean and autoremove,
and if I remove some programs and update+upgrade, my computer should be a happier machine, right?
Swap usage is shown as one of the bar graphs at the top of the HTOP screen. That's where you check swap.

Run HTOP when you feel the system is running slow. Click Mem% to see which program is using the most memory. Click the CPU% tab to see which programs are using the most CPU.

If you find that swap is in use then do whatever you need to do to prevent that. eg don't open more than one or 2 tabs in Chromium etc.

It does not matter much where swap is located..... avoid swap conditions at all costs.

Unless you are running low on disk space, cleaning and removing software will not increase performance.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
boomonster
Posts: 80
Joined: Fri May 11, 2018 11:18 pm

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 19, 2018 1:58 am

Sounds Great! My SD card has around 18 gigabytes of space left, so that's not the problem.
I'll check swap usage this weekend.

geffers
Posts: 384
Joined: Sun Jun 24, 2012 6:25 am
Location: UK
Contact: Website

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 19, 2018 10:15 am

Not sure why forum members have to be so abrupt when someone else asks a question, this is generally a friendly forum. We can politely ask for more info if we want to help, otherwise one can ignore the question.

You supplied enough info for me to give a brief answer.

Most computers tend to slow a bit through usage, temporary files and log files are produced, programs create caches etc, extra programs installed add to this.

A microSD card is not the best medium for running an operating system but works quite well for the Pi. MicroSD cards slow down and can fail due to the continuous writing and deleting that goes on when using for an operating system. Therefore a cheap or low capacity card can cause a slow down.

Many factors and I can see the thread is expanding as more info is supplied.

Geffers

User avatar
boomonster
Posts: 80
Joined: Fri May 11, 2018 11:18 pm

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 26, 2018 1:15 am

I checked swap this weekend, and Youtube really seems to blow it on swap in Chromium. 16.0 MB as soon as I get to the web page!
I think what was happening is I was using Chromium, closed Chromium, but the swap stayed in usage, so my computer acted laggy
and slow until I shut it down and rebooted. -And good to know about the SD card slowing down over time. Thanks!

W. H. Heydt
Posts: 11005
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 26, 2018 1:32 am

boomonster wrote:
Wed Sep 26, 2018 1:15 am
I checked swap this weekend, and Youtube really seems to blow it on swap in Chromium. 16.0 MB as soon as I get to the web page!
I think what was happening is I was using Chromium, closed Chromium, but the swap stayed in usage, so my computer acted laggy
and slow until I shut it down and rebooted. -And good to know about the SD card slowing down over time. Thanks!
It's not that an SD card will slow down over time, it's that each cell can only be written to finite number of times before it fails to work. Unfortunately, that write limit is typically hundreds to a thousand or so times. The "fix" for that (to keep one small group of cells from wearing too soon) is the big reason why just pulling the power on a Pi is a really bad idea. There is a tiny processor in each SD card that moves data around to even out the "wear" (number of writes) across all the cells. This is called "wear leveling". If you drop power while the SD card is doing that, you are likely to have a terminally corrupted file system on the card.

SSDs are subject to the same constraints, but the cells are generally more robust and the internal processor is "smarter", so you are less likely to catch it in the middle of such an operation. HDDs are not subject to this problem.

All of this is why some people are paying attention to the Intel Optane storage. *IF* (yes, that's a very big "if") they come anywhere near the claims Intel has made, they will have the potential to give a major boost in speed and usable lifetime to anything that uses flash now. Even a 3- to 4-fold increase in the number of writes per cell would be pretty revolutionary. A couple of orders of magnitude increase would be absolutely spectacular.

Heater
Posts: 13643
Joined: Tue Jul 17, 2012 3:02 pm

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 26, 2018 9:48 am

If you have ever wondered why SD cards are so unreliable and unbootable Pi are such common occurrences have a read of this article about recovering data from an SD card which includes a good discussion of what goes on inside.

It's amazing these things work as long as they do!

https://joshuawise.com/projects/ndfslave
Memory in C++ is a leaky abstraction .

LTolledo
Posts: 2020
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 26, 2018 10:01 am

boomonster wrote: ....closed Chromium, but the swap stayed in usage, so my computer acted laggy
and slow until I shut it down and rebooted.
whenever I feel that the response is a bit laggy, I always issue this command to reset the swap (on my USB thumbdrive) and regain back some speed (...well... most of it). No need to reboot....

Code: Select all

~ $ /etc/init.d/dphys-swapfile restart
haven't tried it on a microSD installed raspbian though, because I have not (and probably will not) adjust the swap file size on those.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23885
Joined: Sat Jul 30, 2011 7:41 pm

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 26, 2018 10:04 am

Heater wrote:
Wed Sep 26, 2018 9:48 am
If you have ever wondered why SD cards are so unreliable and unbootable Pi are such common occurrences have a read of this article about recovering data from an SD card which includes a good discussion of what goes on inside.

It's amazing these things work as long as they do!

https://joshuawise.com/projects/ndfslave
Unbootable Pi's are not a common occurence. I've had IIRC one SD card go awol in 6 years. Please don't conflate the number of posts stating failure to boot with a high failure rate. Given the number of Pi's in existence (20M), the reports here are a miniscule drop in the ocean.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

Heater
Posts: 13643
Joined: Tue Jul 17, 2012 3:02 pm

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 26, 2018 10:31 am

If I ignore forum posts regarding file system corruption and SD card failure and given there are no statistics available I only have my own personal experience to go on.

I have half a dozen Pi here, from the earliest to the latest, and a number deployed in remote locations. The number of SD problems I have had is of the order of 10. Including one that became very hot and was smoking!

Arguably that is pretty good. It's commensurate with the failure rate of PC's and laptops around here.

Happily recently there have been few problems. I have no idea if that is because Pi have changed some how or my SD cards are better. Or just luck.

It's not something I want to trust for systems that are supposed to work unattended for a long time. To that end I deploy Pi with read-only root file systems.

Bottom line for me is that the failure rate for the intended use is acceptable. After all a repair is only an image download and a cheap SD replacement away.

If you need more reliability take precautions.
Memory in C++ is a leaky abstraction .

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: My Pi 2 keeps getting slower. Help!

Wed Sep 26, 2018 4:17 pm

boomonster wrote:
Wed Sep 26, 2018 1:15 am
I checked swap this weekend, and Youtube really seems to blow it on swap in Chromium. 16.0 MB as soon as I get to the web page!
I think what was happening is I was using Chromium, closed Chromium, but the swap stayed in usage, so my computer acted laggy
and slow until I shut it down and rebooted. -And good to know about the SD card slowing down over time. Thanks!
I think Chromium is known to keep some processes running after the main process has been quit. So - it seems plausible that it might not release the swap-file storage in that case. Maybe there is a way to prevent Chromium from "staying resident" - in which case it might be that you wouldn't need to reboot the Pi.

If your trouble continues, then you could get another card and put a new installation of Rasbian Stretch on it, to see if the new installation is speedier than the present one you're using.
I am the Umbrella man

User avatar
boomonster
Posts: 80
Joined: Fri May 11, 2018 11:18 pm

Re: My Pi 2 keeps getting slower. Help!

Thu Sep 27, 2018 12:15 am

Then would that swap reset command get rid of all the swap Chromium was using? And yes, I do have another
SD card, although it has been somewhat used. I am also going to get another one for an arcade I am building.
So I will try with another SD card. Another thing that could've caused some problems is me pulling the plug on
a frozen RPi 2 quite a few times. And considering the article that @Heater mentioned, I think that could've caused
my (possibly) damaged/worn out SD card. Thread locking has grown pretty bad on my pi, so I've had to pull the
plug quite a bit. :(

LTolledo
Posts: 2020
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: My Pi 2 keeps getting slower. Help!

Thu Sep 27, 2018 10:06 am

boomonster wrote:
Thu Sep 27, 2018 12:15 am
Then would that swap reset command get rid of all the swap Chromium was using?
Well in this case its "...to see is to believe..."
With htop running on another terminal window, open up a new terminal window and enter the command. Watch very carefully what happens on htop...
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

User avatar
HawaiianPi
Posts: 4747
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: My Pi 2 keeps getting slower. Help!

Fri Sep 28, 2018 12:42 am

The obvious way to get more performance would be to swap your old 2B v1.1 for a newer 3B or 3B+ (which also has built-in WiFi and Bluetooth).
boomonster wrote:
Sun Sep 16, 2018 12:37 am
... SD card. Mine has been used for about 2-3 years, it is a class 10 32gb SanDisk Ultra MicroSDHC 1.
There are newer "A1" rated micro SD cards which perform noticeably faster on a Raspberry Pi computer (compared to standard class 10 cards). It really is a difference you can feel, rather than something that just shows up in benchmarks. The SanDisk Ultra A1 cards are affordable and good performers. They're the newer version of what you have now, with better random I/O performance.

I/O performance can be further improved by booting and running your system from an SSD, which should have better random performance and higher IOPS than even an A1 rated micro SD card. Prices of a 128GB A1 micro SD card and SSD are similar, and in larger sizes the SSD could cost a lot less. Smaller ones don't perform as well, so if your storage needs are modest, stick with A1 micro SD cards. USB booting takes longer than booting from an A1 micro SD card, but once the system is up and running it feels faster.

To boot your older Pi2B v1.1 from USB you would write a Raspbian image to the USB drive and copy just the bootcode.bin file from the imaged USB drive to a FAT32 formatted micro SD card (you can also download it here: https://github.com/raspberrypi/firmware/ ... /bootcode.bin).

You can also boot from a hard drive, but that can be more troublesome due to increased power consumption and longer spin-up/ready time. Using the ELUTENG adapter cable mentioned above, I have booted and run a Pi3B from a WD Blue 500GB hard drive harvested from an old laptop. The drive was powered by my Pi's USB port, and the Pi was powered by the official RPF PSU (5.1V/2.5A). Performance from HDD will be less than SSD or A1 card, but if you need large storage capacity or write to the drive a lot, HDD may be a better option.
Last edited by HawaiianPi on Sat Sep 29, 2018 11:01 am, edited 1 time in total.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Heater
Posts: 13643
Joined: Tue Jul 17, 2012 3:02 pm

Re: My Pi 2 keeps getting slower. Help!

Fri Sep 28, 2018 3:01 am

Do you really have to post that picture of your Pi with an SSD here everyday?
Memory in C++ is a leaky abstraction .

User avatar
DougieLawson
Posts: 36316
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: My Pi 2 keeps getting slower. Help!

Fri Sep 28, 2018 6:49 am

Heater wrote:
Fri Sep 28, 2018 3:01 am
Do you really have to post that picture of your Pi with an SSD here everyday?
+1
It is getting tedious.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “General discussion”