How to Get Printer Stats (Page Count, Drum Unit Life, Toner Remaining) from Dell Laser Printers

I have a small Dell E310DW laser printer, which is a rebranded Brother L2340DW wireless printer.  Bought it for $90 three years ago.  Today, I discovered the printer’s internal status page.  Here’s how to get to it:

  1. With the printer on, go to http://dell5bbcd8.local./general/information.html?kind=item (this address may be slightly different depending on whether you have a Brother or Dell printer).  Not sure if part of the address is randomized though.  If it doesn’t work, try putting your printer’s IP address in your web browser’s location bar.
  2. You’ll see a page that looks similar to the one below.  You can go to the home page to see the amount of toner remaining.dell printer info.png

You can also get this info by doing a status print out.

After I bought this printer, I sold my old non-wireless HP LaserJet P1006 printer for $40 on Craigslist.  Even though it needed toner, I still had 4 people competing to buy it.

A few more things I love about this Dell/Brother laser:

  • Fast duplex printing (prints on both sides of the page to save paper)
  • Works wirelessly with no software to install on Macs, iPads, and iPhones
  • You can continue printing even beyond the toner’s estimated print life by enabling “Continue Mode“. Use the printer controls on the printer itself, or log into the printer web management (described above), and set the replace toner option to enable this mode.

After 3 years, I’ve printed 265 pages.  That’s 88 pages a year, or 7 pages a month.  I have roughly 60% of my “starter toner” remaining.  At this rate, I’ll be be able to use the original toner for at least another 3-4 years!  This would be unheard of in the inkjet world.

New Office Chair – the Steelcase Amia

During the pandemic, many of us are forced to work from home – myself included.  Time to put away the dining room seat and get a real office chair.

By far the most comfortable chair at any of the various employers I’ve had has been made by Steelcase – the Steelcase Leap and Amia seats specifically.  But these cost around $700 new.  (Though as of this writing, the Amia is $399 renewed on Amazon)

SteelcaseAmia
Steelcase Amia, in red

So I setup a saved search alert on Craigslist to let me know when any Steelcase Amias come along below $350.  Steelcase chairs pop up every month in my city, but often at a high price.  I was patient, and six months later, I’m sitting on an almost new Steelcase Amia for $200.  I can sit in this thing for hours and not get tired or have a sore back.  Love it!

What I like about the Steelcase Amia:

  • Hyper adjustable armrests (extending all the way forward (and even inward/outward), to support your elbows when typing/mousing
  • Seat slides forward to support long thighs
  • Tall enough to support long backs
  • Solidly built all around – not flimsy or wobbly like those no-name chairs you see at Staples or Costco
  • Traditional styling

There’s really nothing I dislike about it, and I’m kind of picky.  Colleagues at work have also gotten Steelcases, but also recommended the X-Chairs, the IKEA Markus ($199), and the Herman Miller Aeron.  The only one of those I’ve tried is the Aeron.  I thought the Aeron was surprisingly uncomfortable for such an expensive chair, and it looks weird.  Many people disagree, so be sure to try before you buy, if you can.

What Happens When You Request a Web Page

Say you want to go to example.com. What happens under the hood after you type the page’s address into your browser?

  1. DNS lookup:
    1. DNS caches are checked: browser cache, operating system cache
    2. Local computer’s hosts file and the router’s cache are checked
    3. Local computer’s resolver config is checked for the address of the recursive DNS server (ex. ISP’s DNS server).  That server’s cache and records are then checked for example.com, usually via UDP port 53.

      DNSRequest-ccnahub
      Image credit: ccnahub.com
    4. Root DNS servers for .com are checked
    5. Top Level DNS servers are checked
    6. Authoritative DNS servers are checked
    7. If the record is found, the result is cached by the recursive DNS servers and your local system
  2. Browser sends HTTP request to the IP returned by the DNS server:
    1. Makes system call to the operating system’s kernel to create a TCP internet socket (fd = socket(AF_INET, SOCK_STREAM)
    2. Connects to a port (ex. 80) on an IP (from DNS) (fd, 1.2.3.4:80)
    3. Makes a request (write (fd, "GET /index.html HTTP/1.1)
    4. Reads the response (index.file=read(fd ...))
  3. Server responds and sends back the requested HTML file
  4. Browser renders HTML
  5. Browser sends additional requests for objects embedded in the HTML file (ex. CSS files, images, JavaScript, etc.)

I used the following resources in researching this:

Jeff Smith’s DNS Explained tutorial
Steven Bradley’s What Happens When Your Browser Requests a Web Page
Julia Evan’s Bite Size Networking wizard zine

Hope this helps anyone curious for a deeper level understanding of this!

Update: A week after posting this, I happened across a page dedicated to explaining this process in exhaustive detail, right down to what happens when you press the first key!  (on a physical or virtual keyboard)

Troubleshooting Networks – Layers 4-7 in the OSI Model

I was recently asked how to troubleshoot layers 4-7 of the OSI model.

OSI
Lower layers are drawn wider to show protocol encapsulation

Layer 4 (Transport) : Most problems at the transport layer have to do with blocked ports.  Ensure there are no firewalls (ex. iptables) blocking the TCP/UDP ports you’re trying to troubleshoot.  You can also try temporarily disabling quality of service (QoS).

Layer 5 (Session) and Layer 6 (Presentation) : Example protocols in these layers include sockets in the session layer and MIME in the presentation layer.  These two layers play a less active role in the functioning of the network compared to the other layers of the OSI model.  There usually isn’t anything here to troubleshoot.

Layer 7 (Application) : The app layer is where client-server apps are used.  For example, HTTP, HTTPS, SMTP, SSH, DNS.  Regarding DNS, use the dig or nslookup commands as a starting point to figuring out why DNS is failing.  For HTTP, you might use Apache’s or NGINX’s stats pages.  (Be sure to turn these off when you’re done using them though, for security.)  For SSH, SMTP, and all cases: check the logs.  Temporarily enable debug logging if you have to.  You can also use tcpdump to filter TCP/IP packets and analyze the protocols used.
There is certainly more that could be said here, but I just wanted to write down what I’ve learned so far.  Credit for much of the above info goes to:

Sukesh Mudrakola at Techgenix
Brendan Gregg’s book on Systems Performance

Origin of the Glory Be Doxology

One of the prayers I try to say every day is the Glory Be:

Glory be to the Father
and to the Son
and to the Holy Spirit,
as it was in the beginning
is now, and ever shall be
world without end. Amen.

This is a doxology, or a liturgical formula of praise to God.  The Glory Be has been used in a form similar to what we see above since around the year 529, but it actually comes straight from Sacred Scripture.  For example, see 1 Chron 29:11, Phil 4:20, and 2 Cor 13:14.

glory_be_prayer_800.jpg

From Catholic Answers: If at any point in our lives, in joy or in sorrow, in the middle of troubles or struggles, in hope and in fear, when perhaps we cannot find the words, we can always pray perfectly that God may be glorified always, and so we will be praying for all we really want. In a way, we will be praying as God “prays,” since the Savior prayed in the face of his deepest suffering, “Now, Father, glorify your Son with the glory he had before the world began”—that is, “as it was in the beginning, is now, and ever shall be, world without end. Amen.”

 

Troubleshooting Why My Mac Was Slow: photoanalysisd

I woke my Mac after it had been sleeping for a while and I noticed it was slower than usual.  Clicking browser tabs felt like pushing through molasses.

I opened a Terminal window and typed: top, and immediately1 saw photoanalysisd consuming 95% CPU.  It showed no signs of letting up, after several minutes of watching it.

  • What was it doing?
  • Wasn’t photo analysis only supposed to happen when your Mac is idle or in PowerNap/sleep mode?

I opened Photos.  Now two CPU hungry processes were going: Photos itself and photoanalysisd.

After a quick web search, I went straight to the first hit at Stack Exchange, and found this gem:

  1. Start Photos, let it continue past the first dialogue box;
  2. Now Preferences in the app menu is clickable (if it wasn’t before);
  3. Preferences > General , and untick both check boxes in Memories;
  4. Close Photos.
    This stops photoanalysisd cold, no reboot or kill required.
uncheck-photoanalysisd.png
Untick these two boxes in Photos > Preferences > General > Memories

Not sure how this guy figured this out, but this tip worked great.  It did indeed stop photoanalysisd.  Hopefully this trouble won’t crop up again.

Interpreting vmstat (virtual memory and system statistics)

I was asked about vmstat recently and didn’t know as much as I should.  I’m writing a brief post to help myself learn it a little more.

Here’s an excerpt of the manual:

vmstat.png

So what can you do with vmstat?  If you run it without specifying any parameters, it gives you an average view of virtual memory and system usage since your last reboot.

If you run it with the 1 parameter (vmstat 1), it runs (and re-measures) every 1 second, until you break out of it:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0      0  44712 110052 623096    0    0    30    28  217  888 13  3 83  1  0
 0  0      0  44408 110052 623096    0    0     0     0   88 1446 31  4 65  0  0
 0  0      0  44524 110052 623096    0    0     0     0   84  872 11  2 87  0  0

If you want to see how much memory is swapped in/out from disk, check out the si/so (swapped in/swapped out) columns.

If the amount of memory in the free column is low, you’ll want to check which processes are consuming the most memory.  (with top, for example)

But wait – you can also troubleshoot CPU and disk bottlenecks with vmstat:

For disk bottlenecks, look at the b (blocked) column.  This tells you the number of threads that were blocked/waiting on IO completion.  It should be 0 most of the time, but if it’s not, you can investigate further with iostat.

For CPU bottlenecks, look at the r (run queue) column.  These are the threads that were waiting for a CPU to become available in order to run.  If you see more than 2-5 times the number of CPUs on the system listed in this column, there may be a CPU bottleneck.

For more info, see The Geek Diary’s guide to troubleshooting with vmstat – it’s an excellent resource.  And if you want to know how to run something slightly similar to vmstat on macOS, try vm_stat.

Interpreting iostat Disk I/O Statistics

I was asked a few questions about iostat that I was unable to answer off the top of my head, so I decided to write down a few notes on it to help learn.

From the manual (on macOS) :

  • iostat displays kernel I/O stats on terminal, device, and cpu operations.
  • The first stats you see are averaged over the system uptime.
  • To get info about current activity, a suitable wait time (in seconds) should be specified (with -w), so that subsequent sets of stats will be averaged over that time.

Here is the output from running iostat on my primary disk with a wait time of 5 seconds. This was done while copying a 4GB file over 25 seconds:

%iostat -w 5 disk0
              disk0       cpu    load average
    KB/t  tps  MB/s  us sy id   1m   5m   15m
  261.14  372 94.88  29 14 58  2.53 2.32 2.35
  333.73  452 147.24  29 11 60  2.49 2.31 2.35
  395.37  406 156.82  27  8 65  2.45 2.31 2.35
  254.52  605 150.47  37 11 52  2.41 2.30 2.35
  409.59  391 156.26  25  6 69  2.46 2.31 2.35

KB/t: kilobytes per transfer
tps: transfers per second
MB/s: megabytes per second
us: % of cpu in user mode
sy: % of cpu in system mode
id: % of cpu in idle mode

The tps number is the I/O Operations Per Second, or IOPS. You can compare this to Wikipedia’s list of average IOPS for different storage devices.

My Mac’s SSD hit a high of 605 IOPS during the file copy, which is 3X higher than the fastest mechanical disks, but nowhere near as fast as some of the enterprise SSDs that you can buy.

iostat-examples.png

One note that I found interesting was this, from vaneyckt’s article on iostat at Coderwall:

[On Linux versions of iostat], some people put a lot of faith in the %iowait metric as an indicator for I/O performance. However, %iowait is first and foremost a CPU metric that measures the percentage of time the CPU is idle while waiting for an I/O operation to complete. This metric is heavily influenced by both your CPU speed and CPU load and is therefore easily misinterpreted.

For servers, you should be sending your iostat statistics to an internal data collection and graphing service, so you can get an idea of a baseline over time.  You can then try and correlate spikes in disk I/O with other data, such as slow web site performance, database queries, etc.

Jerky Animation in Safari Reader

I was trying to figure out why Safari’s Reader animation was smooth on my retina MacBook display (“1680×1050”), and super smooth on my old iPad Pro (1668 x 2224), but jerky/stuttering on my USB-C-connected external 4K monitor in any resolution except “1280×720”.  This even happened on simple web sites with very few photos.

safari-reader
Safari Reader Mode is just slow at 4K – if you don’t have a discrete video card. Image credit: Apple

Turns out it’s the VRAM.  From iCruiser7 on Reddit:

Pushing high-res external monitors primarily depends on VRAM size and bandwidth. Integrated graphics have to use system RAM as VRAM which is slower compared to dedicated VRAM. If you only had 8GB system RAM then the shared VRAM would further strain the entire system since less system RAM is available to apps.

Now, the new G7 graphics have more computational performance and are coupled with faster 3733 LPDDR4X system RAM which provides more bandwidth so performance on an external display should be at least somewhat better. However, a discrete graphics card would bring much more improvement. So if pushing high-res external monitors is your goal, I’d recommend you either 1. upgrade to a 16-inch MBP or 2. get a eGPU.

I looked into eGPU prices and they can be $300 for the enclosure alone.  And $700 for an Apple-recommended one with a video card included.  The cheapest MacBook Pro 16″ with an extra video card included is $2100!  I’m going to pass on that and see what external graphics performance is like on Apple Silicon.

Wish there was a way to turn Safari’s reader animation off.  If anyone knows how, please let me know.

Quick Fix for Slow Scrolling in macOS

On long web pages, especially when using a high resolution (4K+) external monitor, scrolling takes a long, long time.  Feels like you’re dragging the page through molasses.

I found a quick fix for this, buried in Accessibility preferences:

  1. Open System Preferences > Accessibility
  2. Scroll down to Pointer Control
  3. Hit Trackpad Options… and move the Scrolling speed slider to Fast.

trackpadoptions.pngWhy this isn’t in Trackpad preferences, I don’t know.  It used to be, back in 2011.  I guess Apple decided the Trackpad preferences were getting too overloaded and hid them deep in Accessibility settings.