News for hackers. Stuff that matters.
Re:Reducing Tailscale’s binary size on macOS by zacwest on Friday February 17, 2023 @10:58AM (#34836163)
Generally on Apple platforms the move here would be putting the shared binary into a dynamic .framework rather then trying to eliminate the shared dependency. Is this a limitation of authoring it in Go that it has to be entirely static?
Re:Reducing Tailscale’s binary size on macOS by hn_go_brrrrr on Friday February 17, 2023 @11:44AM (#34836953)
It could also be a legacy of a lot of the team coming from Google, which statically links everything except glibc.
Re:Reducing Tailscale’s binary size on macOS by xxpor on Friday February 17, 2023 @05:16PM (#34841370)
I'm surprised Google isn't using musl then at this point.
Re:Reducing Tailscale’s binary size on macOS by favorited on Friday February 17, 2023 @07:11PM (#34842402)
They were spearheading the LLVM libc project at one point, I'd assume they'd replace glibc with that if anything.
Re:Reducing Tailscale’s binary size on macOS by saagarjha on Saturday February 18, 2023 @02:26AM (#34844809)
Musl is slow.
Re:Reducing Tailscale’s binary size on macOS by mihaip on Friday February 17, 2023 @12:08PM (#34837294)
(I’m the author of the post)

The solution we ended up with was partially a matter of the minimum change to fix the issue, and partly because we have a lot of platforms to cover with a small team, so the fewer platform-specific concepts we have (frameworks in this case), the easier it is to maintain.

Re:Reducing Tailscale’s binary size on macOS by manmal on Friday February 17, 2023 @01:55PM (#34838763)
As a user I’d prefer faster startup over shaving off a couple MB tbh.
Re:Reducing Tailscale’s binary size on macOS by hansvm on Friday February 17, 2023 @02:56PM (#34839624)
Even if so that takes benchmarking on the target systems. Linking can be fast compared to reading a few extra MB from disk.
Re:Reducing Tailscale’s binary size on macOS by manmal on Friday February 17, 2023 @04:38PM (#34840917)
With SSDs approaching 10GB/s reads, I think that’s negligible.
Re:Reducing Tailscale’s binary size on macOS by saagarjha on Friday February 17, 2023 @03:47PM (#34840325)
Calling dlopen is perhaps one of the slowest way to bring in libraries on Darwin.
Re:Reducing Tailscale’s binary size on macOS by mihaip on Friday February 17, 2023 @04:01PM (#34840512)
What would you recommend? dlopen is only used when running in CLI mode (which is not super performance sensitive), but not making it slower than it needs to be would be good too.
Re:Reducing Tailscale’s binary size on macOS by saagarjha on Friday February 17, 2023 @10:25PM (#34843564)
You should link against the library directly. dyld’s optimizations are complex, especially when it comes to third party code, but by linking directly the system can cache some of the work.
Re:Reducing Tailscale’s binary size on macOS by CharlesW on Friday February 17, 2023 @12:57PM (#34838006)
As a Tailscale user, nice work! I applaud the effort and appreciate the result.
Re:Reducing Tailscale’s binary size on macOS by tarasglek on Friday February 17, 2023 @02:40PM (#34839351)
Guys, please figure out a way to reduce your footprint on openwrt.

11452 -rwxr-xr-x 1 root root 11.2M Sep 1 2021 /usr/sbin/tailscaled

7612 -rwxr-xr-x 1 root root 7.4M Sep 1 2021 /usr/sbin/tailscale

I love tailscale, but it forces me to use usb sticks on most of my openwrt routers.

Re:Reducing Tailscale’s binary size on macOS by mihaip on Friday February 17, 2023 @03:57PM (#34840469)
There is a way to build an even smaller version of Tailscale for embedded systems, though there are some trade offs with regards to ease of use and security. https://tailscale.com/kb/1207/small-tailscale/ has more details.
Re:Reducing Tailscale’s binary size on macOS by tarasglek on Saturday February 18, 2023 @03:13AM (#34845039)
Method described gets most of the win from UPX. That's not applicable on openwrt as it already uses lzma on filesystem level. Switching to UPX would cause excessive ram usage as binary would be in anonymous memory and no longer be backed by filesystem pages.
Re:Reducing Tailscale’s binary size on macOS by newman314 on Friday February 17, 2023 @02:45PM (#34839426)
I seem to remember reading that upx had a performance impact (startup times?).

@mihaip, have you been able to measure any changes before/after?

Re:Reducing Tailscale’s binary size on macOS by mihaip on Friday February 17, 2023 @03:59PM (#34840486)
upx is not used in the macOS build (we only mention it as a possibility in https://tailscale.com/kb/1207/small-tailscale/, which is for embedded systems), so I have no done any benchmarking with it.
Re:Reducing Tailscale’s binary size on macOS by duskwuff on Friday February 17, 2023 @03:42PM (#34840267)
1.5 MB for a stub binary which does nothing but load and call a symbol from another file seems a little excessive in its own right.
Re:Reducing Tailscale’s binary size on macOS by mihaip on Friday February 17, 2023 @04:12PM (#34840646)
The main binary also contains Tailscale’s GUI (onboarding, auth, menu, notifications, etc) so it does a little more than that.
Re:Reducing Tailscale’s binary size on macOS by mrpippy on Friday February 17, 2023 @05:46PM (#34841675)
Plus, it's a universal binary with x86_64 and arm64 slices.
Re:Reducing Tailscale’s binary size on macOS by duskwuff on Friday February 17, 2023 @05:51PM (#34841711)
Oh, if that's the case then 1.5 MB seems much more reasonable. Never mind.
Re:Reducing Tailscale’s binary size on macOS by 1vuio0pswjnm7 on Friday February 17, 2023 @04:03PM (#34840540)
Agreed. Strangely discussions of bloat sometimes trigger snarky replies:

https://news.ycombinator.com/item?id=34732782

Re:Reducing Tailscale’s binary size on macOS by preseinger on Friday February 17, 2023 @08:21PM (#34842863)
bloated is relative and subjective but the only context where an 11MB binary could be considered bloated is embedded

hard to take seriously the idea that 11MB is bloated in a normal linux server or user desktop environment

Re:Reducing Tailscale’s binary size on macOS by 1vuio0pswjnm7 on Saturday February 18, 2023 @12:51AM (#34844314)
If the program in inteneded by me to run on a small form factor computer with limited storage, such as a router, then the program nearly doubling in size is going to draw attention.

Bloated is subjective. That means there will different opinions, like it or not. Not every computer owner has the same usage patterns nor equipment.

What's interstig is that I never used the word "bloated". I simply noted the program size increased. That is not a subjective opinion it is a fact.

Re:Reducing Tailscale’s binary size on macOS by duped on Friday February 17, 2023 @08:19PM (#34842855)
That's pretty normal for statically linked executables unless you're aggressively stripping and removing things (which is hard to do)
Re:Reducing Tailscale’s binary size on macOS by least on Friday February 17, 2023 @04:49PM (#34841053)
Somewhat tangential, but ever since a recent update of the MacOS tailscale client, I've been unable to connect to any other exit nodes. I click on the exit node I'd like to connect to and it just silently fails. I tried making a shortcut as well that would connect to that node and it also fails. I've verified the exit node itself is working correctly on other devices, it only fails on the Macbook.

Has anyone else encountered this issue?

Re:Reducing Tailscale’s binary size on macOS by mihaip on Friday February 17, 2023 @09:16PM (#34843160)
Can you sent a message to [email protected] about this and include a bug report ID (option click on the Tailscale menu icon and choose Debug -> Bug Report…)?
Re:Reducing Tailscale’s binary size on macOS by mihaip on Tuesday February 21, 2023 @07:14PM (#34889695)
One change that went into 1.36 is that you can no longer use an exit node while advertising one (https://github.com/tailscale/tailscale/issues/3569). The Mac UI was not updated for that in time, but the next release the menu items should be disabled correctly.
Re:Reducing Tailscale’s binary size on macOS by ysleepy on Saturday February 18, 2023 @04:25PM (#34851259)
I'm surprised they didn't go for the binary size analysis tools like

https://github.com/google/bloaty

Or goweight.