martedì 28 ottobre 2025

Stabilizing latency under LTE links with CAKE queueing on MikroTik routers

Getting QoS right is essential for bandwidth-constrained links. Simple FIFO queues, which are what most basic routers implement by default, quickly fall apart when one host "misbehaves" and generates heavy traffic, clogging the uplink. Per-connection queueing (PCQ) or various fair-queueing (FQ) algorithms can help when you have a guaranteed or even somewhat stable uplink bandwidth, as is the case with dedicated fiber and most fiber PON or DSL links.

Enter LTE and radio links. Implementing queueing on these links is especially difficult, as they have very wide and even sub-second bandwidth variations. PCQ and FQ algorithms are not suited to this case, as they need to know the bandwidth "ceiling" under which to operate. The CAKE queueing algorithm, however, is much better equipped to handle such a scenario, as it can "auto-rate" the uplink bandwidth. It does so by watching the timing of incoming TCP ACKs. If they start arriving with delays, it infers that the uplink is congested (because the data packets that triggered those ACKs got delayed) and reduces the shaper rate. If the ACKs arrive smoothly, it cautiously increases the rate.

Configuring a basic CAKE queue on MikroTik Routers (ROS 7) involves defining two queue types (one for TX and one for RX) and a simple queue targeting the WAN interface:

/queue type
add cake-diffserv=besteffort cake-flowmode=dual-srchost cake-nat=yes cake-rtt=80ms kind=cake name=qtype_cake_tx
add cake-diffserv=besteffort cake-flowmode=dual-srchost cake-nat=yes cake-rtt=80ms kind=cake name=qtype_cake_rx

/queue simple
add max-limit=100M/100M name=queue_internet queue=qtype_cake_rx/qtype_cake_tx target=lte1

Here are a few things to note and potentially adjust.

In the /queue type section:

* cake-nat must be set to yes if you're performing NAT on the interface, as it will ensure CAKE is able to isolate individual flows.

* cake-rtt must be set to a realistic round-trip time to a typical internet destination. In my case, the RTT when I ping www.google.com or time.windows.com is about 50 to 80ms. I will set it to 80ms because I'd rather have a bit more bandwidth than tighter jitter. If tighter jitter were to be preferred, I'd set it closer to 50ms.

In the /queue simple section:

You can specify a bandwidth "ceiling", as I did setting 100 Mbps both for TX and RX, or leave it unlimited.

In my very brief testing with Speedtest.net and such I have found this setup effective not only in resolving the jitter problem under heavy traffic, but also in improving overall bandwidth, perhaps because of the reduction in "wasted" packets such as TCP retransmissions. 

Bear in mind that CAKE is computationally expensive, and while newer ARM based routers will handle it no problem, my MIPSBE based BaseBox 5 runs a little bit closer to full CPU usage than I would like. 

martedì 14 ottobre 2025

Bulk operations on MikroTik switch ports (interface range)

RouterOS' syntax lacks a "range" statement, like on Cisco IOS and similar CLIs, but you can leverage its scripting capabilities even in the interactive shell, and just do a for loop:

for i from=1 to=28 do={interface bridge port add bridge=bridge1 interface="ether$i"}

Scanning film with a flatbed scanner: what you can expect and what worked for me

As many film photographer will know, getting sharp scans out of a flatbed scanner is challenging at best, especially if you're doing it at high resolution, for example for inkjet prints. The issue lies mostly in the scanner's optics: most flatbeds with TMAs have a fixed focus lens that is rarely tuned to precision, and while the sensor and stepper motors could be capable of acquiring high resolution (altough noisy) images, if the media is out of focus or the lens just isn't that sharp, the actual, optical resolution of the captured image will be much lower, often in the 1400 to 2000 DPI range.

While 120 film, with its larger area, is more forgiving to lower resolution scanners, you might give up on getting a sharp scan out of a tiny 135 frame on a mid-range flatbed. However, they can be made to work for up to 13x18 prints (and maybe 18x24 if you're not too hung up on details), and they are certainly suitable for social media uploads. The key is to find a proper workflow, as often the software provided by the manufacturer is uncapable of delivering neither a high color depth for later grading in photo finishing software, nor a satisfying native inversion.

I've developed the following workflow for my HP Scanjet G4010 and G3010 scanners, which have an optical resolution of about 1400 DPI. It works by capturing a positive image and then inverting it manually in RawTherapee.

1. Capture a positive, 48-bit TIFF file from VueScan or Silverfast

This is crucial in order to retain the full color depth, and having maximum flexibility when inverting and grading the negative. My VueScan settings are as follows.

Input: 

- Scan resolution: as high as it goes. My G3010 does 4800 DPI, so that's what I will select. If you're running low on disk space you could go lower, albeit losing a bit of editing flexibility, and not really notice a difference. On my setup I could go as low as 2400 DPI without losing significant detail

- Mode: Transparency (it lights up the TMA lamp and scans only the negative strip area)

- Media: Image (it captures the negative without doing any inversion)

- Bits per pixel: 48-bit

- Lock exposure (ensures all negatives are scanned to the same exposure settings)

- Mirror (you should load the negatives emulsion-side down, and this flag ensures the output image is already mirrored)

Crop:

- Crop size: Maximum, Multi crop: Off (it seems that the frame detection does not work great when dealing with negatives)

Color:

- Color balance: None

- Output color space: Adobe RGB (again, we want to retain the most information in our TIFF file)

2. Inverting it in RawTherapee

RawTherapee has a built-in Film Negative profile. That will, however, require adjustments in:

- The reference exponent (tuned to the lightness of the negative)

- CMY levels

- White balance (in order to balance a scanner light that could be slightly off the 5500K mark)

Tune those values to a baseline that is identical and looks good across all the scanned negatives. That means:

- No cyan, magenta or yellow "casts" on the pictures 

- White balances of the scan matches the white balance of the film stock

- No burnt highlights, no muddy shadows

Then apply the profile to all the negatives in the batch, and you can start grading then one by one.

3. Some tricks to make a low resolution, noisy scan look good

You cannot recreate detail that was lost to the scanner's poor optical performance. What you can do in order to mitigate a soft looking image, is to use an unsharp mask and local contrast enhancement to fake it into looking a bit more sharp.

Also, those scanners produce pretty noisy output. The Noise reduction tool in RawTherapee, when set to work in the L*a*b* color space and in Conservative mode does a good job of removing a bit of RGB noise without further destroying the sharpness of the picture.

As a side note, some insist that you should not grade your negatives digitally, as it detracts from the film stock's characteristics and color science. I think that's nonsense, since even when doing darkroom prints you're expected to be doing some fine tuning in terms of filtering and exposure, but you do you.

The obvious drawback to this method: it takes time. Certainly, if you're in a hurry, VueScan or Silverfast might do an okay job of inverting negatives, and if you save them to 48-bit TIFF you still retain huge flexibility for doing later edits. What you will lose by letting the software doing the inversion for you is the consistency of having every frame inverted to the same exact baseline spec.

To conclude, a wholehearted recommendation: if you're serious about shooting and scanning film, get a dedicated film scanner (Primefilm or Plustek scanners are good, cost-effective options) or a DSLR scanning setup. But if you're dipping your toes in this your old scanner might work fine for Instagram posts, and there's a lot that can be squeezed from even an older, cheaper machine.

Shots from Trieste

Ilford Pan 400, Minolta Dynax 700si, Minolta AF 24-85mm f/3.5-4.5, scanned on a Nikon Coolscan IV ED and inverted/graded in RawTherapee.

Solving USB communication issues on Nikon Coolscan IV ED (LS-40 ED)

This blog post addresses some common issues on the Nikon Coolscan IV ED/LS-40 ED film scanner. Many report problems that seem to be related to USB communication on newer operating systems (that is, every 64-bit Windows version and modern Mac OS). For example:

* On Windows, the device fails to initialize (yellow warning sign in Device Manager), often with the message "This device cannot start. (Code 10) insufficient system resources exist to complete the API."

* On Mac OS, with Vuescan, the scanner seems to work at first, however it ceases to communicate after one or two successful scans

* On Mac OS, with Silverfast, the scanner is not recognized at all

This is due to issues in the USB routines of firmware 1.05 that were corrected on 1.10 and later revisions.

To check the current firmware revision, it is sufficient to open the Nikon Scan program, and it will tell which version the scanner is on on the window title:

If you're on firmware 1.05, you will have to update. The following steps will work for updating to version 1.20, which is what worked for me.

You're going to need:

* A Windows XP 32-bit or Windows 2000 computer (or virtual machine with USB pass-through capabilities). It's the only platform on which a 1.05 scanner can be reliably connected and updated

* The Nikon Scan 3.12 ISO (easily obtainable on the Internet Archive).

* Crucially, the 1.20 firmware updater. This is not found as easily and i cannot share it (it already got taken down from Mega for copyright claims), but you can look for a Zip bundle called LS40FW120_WIN or LS40FW_WIN on the Web. There's a Facebook group for Coolscan users, which gathers a lot of very experienced and helpful people: I encourage you to search for it or ask there.

Edit: it seems it's available on the DriverGuide website. It's sketchy, but it's seems to be legit. 

DO NOT attempt to install Nikon Scan 4 first, as you will end up with the wrong driver version and i guarantee you it's almost impossible to get rid of it, as its uninstaller does not remove the driver. You MUST use version 3.12. If you have updated to Nikon Scan 4, you will be greeted with this screen:

Here are the steps:

1. Boot Windows XP and connect the scanner via USB

2. Install Nikon Scan 3.12, using the Autorun setup

3. Check if you can do a successful scan

4. Unzip the LS40FW120_WIN.zip file, and launch the Windows\COOLSCANIVED_120.exe executable

5. Follow the procedure to update the firmware

Easy as that. Now you should be able to connect it to a Windows 10/11 or current Mac machine without issues.

If you're on Windows and it's still not recognized, you may need current drivers for it.

The FastPictureView website provides them for free, or you can choose to use paid scanning programs like VueScan or Silverfast which already include them.

martedì 10 giugno 2025

Notes on Dell Compellent (SC Series) storage arrays

Dell SC Series/Compellent storage arrays make heavy use of storage virtualization features, and that can sometimes lead to a behavior that is opaque to the user and difficult to predict. Here are some notes on their inner workings that may help administrators manage them more effectively.

Disk space allocation

Compellent arrays only allocate space for blocks only when you fill them with non-zero data. This means that the following operations DO NOT take space on the array:

- Creating a volume

- Formatting it with almost any possible file system

- Zeroing a file (for example, dd if=/dev/zero ... on Linux or creating an eager-zeroed VMDK in VMware)

That means that, for example, that thin, thick or eager-zeroed thick provisioned VMDKs in VMware allocate physical disk space on the array in (almost) the same way - you can safely use thick provisioning for everything.

Storage tiers, RAID levels and rebalancing

Disk space allocated for each storage tier is allocated dynamically. That means, it's perfectly normal for the usage statistic of a storage tier to be always close to 90%, it's working as intended.

By default, inside each storage tiers, you will have a RAID 10 and a RAID 5 or 6 (depending on the redundancy setting) level. When you write to the array, this happens:

- The array tries to write to the RAID 10 level

- If the RAID 10 is full, the array writes to the RAID 5/6

- If the RAID 5/6 is full, the array tries to write to the next available (lower) storage tier. First to RAID 10, then to RAID 5/6.

If all the RAID levels on all the storage tiers are full or near full, the system will allocate more disk space. Is it perfectly common and intended behavior to have a storage type reach 100% usage, the array will just allocate more disk space to it.

It is discouraged to force writes directly to a certain RAID level by using custom storage profiles.

Recovering from read-only

If the array reaches 100% usage on all storage types/RAID levels and is unable to allocate more space, it stops accepting writes from the connected servers. That means that the only way to recover is to

- Add disks

- Delete snapshots

- Delete volumes

domenica 3 settembre 2023

Gigabit Ethernet and 10-Gigabit Ethernet standard physical media cheatsheet

Gigabit Ethernet

1GBASE-BX Single strand of single-mode fiber (frequently labeled as BiDi)
1GBASE-LH Single or multi-mode fiber pair
1GBASE-LX Single-mode fiber pair
1GBASE-SX Multi-mode fiber pair
1GBASE-T CAT5 cable
1GBASE-TX CAT5 cable

10-Gigabit Ethernet

10GBASE-BR Single strand of single-mode fiber (BiDi)
10GBASE-BX Single strand of single-mode fiber (same as above, BiDi)
10GBASE-LR Single-mode fiber pair, long range
10GBASE-LRM Multi-mode fiber pair, long range
10GBASE-PR Standard for EPON/EFM point-to-multipoint fiber
10GBASE-SR Multi-mode fiber pair, short range
10GBASE-T CAT6A cable


In evidenza

BGP configuration on Sophos XG/XGS firewalls

Sophos XG firewalls, at the time of writing, do not offer sufficient flexibility for configuring BGP via the web panel (namely, you cannot e...