
Why I stuck with Windows for 6 years while developing Discourse - sams99
https://samsaffron.com/archive/2019/03/31/why-i-stuck-with-windows-for-6-years-while-developing-discourse
======
jacobsenscott
Having used windows for several years, linux for several years, and currently
macos for several years (because that's what work gave me) - linux is by far
the most stable and easiest to manage OS, after you get past the initial
learning curve. The main reason is you can actually fix problems. You pretty
much know why every single bit of software is there for and how to configure
it. You google the problem and someone has released a patch, or instructions
on what configuration changes need to be made. Or you can roll back to old
versions of software easily.

Also you are a hero because you catch and fix production problems nobody else
sees or understands because production is running linux.

If you have a problem on OSX you just get 500 people telling you to reset your
pram, and really you just need to wait for the next osx update. You certainly
can't rollback an osx update. Nobody knows whats wrong because nobody has
access to the code. Even if you did - each update is millions of lines of
code. It is crazy town.

Same for windows except there is not pram to reset. You just reboot until the
next update I guess.

~~~
titanix2
> linux is by far the most stable and easiest to manage OS

Nice April fools.

~~~
kuzimoto
Anecdotally, this is true for me. My Arch machine runs for months with no
issues. My XPS running 10 blue screens once every several weeks, and generally
has issues after running too long.

To be fair it could be due to the general buggy-ness of the TB16 Thunderbolt
dock.

~~~
titanix2
Yeah of course, different people will have different experiences. Mine was
being never able to make wifi work, random destruction of the GUI when I
plugged an external monitor, difficulty to install and configure eastern
languages IME, sound issues, etc. That was a very instructive period as
undergraduate in informatics, but I got tired after a while to constantly fix
my system instead of getting things done. Still using it as a server OS, where
it shines.

~~~
StudentStuff
I've jumped from Debian 7 to Debian 9 without issue, and the Gnome Software
Center makes installing apps a point and click process (reminds me of Click N
Run from Linspire...).

There are notable fit and finish issues with other distros, but from what I've
seen the Debian package maintainers consistently make decisions to protect the
package archive from breakage, whether that be holding back a FreeCiv point
release over a buggy UI element, or stripping out non-free parts of Chromium
that upstream bundles.

------
mastazi
I've used Linux as my main desktop OS for about 3 years, from around 2010 to
around 2013 (so maybe some things changed in the meantime).

The article says that you pay a "VM tax" by running in a Linux VM in Windows
or by using WSL, but by using Linux directly you end up "paying" in other
areas, for example in terms of less-than-perfect drivers (which leads to
problems such as worse battery life, worse graphical performance etc). In an
ideal world, laptop and GPU makers would put as much effort developing Linux
drivers as they do when they create Windows drivers, but unfortunately this is
not the case.

Another point is that, even if you are running Linux on your dev machine, it
is often challenging to have a local environment that is as close as possible
to your production one; for example where I work we have Ubuntu 16.04, Ubuntu
18.04 and CentOS (and with various combinations of installed packages), even
if I was using a Linux laptop, I would still need containers to get all the
different environments right. The only case where you could use no containers
at all is if you had all of your servers running the exactly the same
environment.

Finally there is the issue of some pieces of software not being available for
Linux, 95% of the times you can find a Linux equivalent that works for you
but, in my experience, there were still rare cases where I had to resort to
Wine or some Win VM just to run some specific tool that was needed to do my
job.

PS My job, at the time I was using Linux as my main desktop OS, and during the
couple of years after I switched back to Windows, was about PHP, Python and
Java web apps deployed on Linux servers, so my comments above should be taken
in this context. Maybe in other fields of software development there are
different factors to take into account.

PPS I have also tried MacOS, on the one hand it's great that Mac is UNIX, but
on the other hand it's not Linux so, if you want to closely replicate your
production Linux environment, you will still need VMs or containers.

~~~
baroffoos
I picked a Dell XPS for development and it runs linux amazingly well. Only bit
that doesn't work out of the box is the fingerprint scanner but there are
unofficial drivers for it.

With web development its so trivial to do everything you need on linux and
almost all of the time its easier to set up on linux or mac than on windows.

~~~
themodelplumber
Agreed, using an XPS here too. I remember when I started looking for webdev
tools back when I moved to Linux as a daily driver. I was bummed that there
weren't any really nice FTP clients. Turns out my file manager was a step
ahead of me with ssh:// and various other niceties. It was all built in.

~~~
dragosmocrii
Been using FileZilla forever. Very convenient if you manage lots of sites

~~~
themodelplumber
I used to use it, too. Does it still store all your server login credentials
in plain text?

~~~
dragosmocrii
Lol, thanks for pointing that out as I was not aware of it. Looks like now
FileZilla has support for a master password that's used to encrypt stored
passwords.

~~~
themodelplumber
Cool. Encryption is better than base64 for these things :-)

------
nickjj
WSL isn't too bad nowadays. I would go as far as saying it's very good. I've
been using it for full time development for over a year now.

I've run 100,000+ line Rails apps in WSL (well technically through Docker,
which I connect to through WSL) and I never noticed a slowdown that was bad
enough to make me think "this sucks". It's always been pretty good. I run all
sorts of Rails, Flask, Phoenix and Webpack driven apps and all of them run
fast enough where I don't think twice about it.

Personally, I find the WSL set up somewhat close to native Linux in terms of
the user experience. I'm not talking about I/O performance, but I mean how it
feels to use the OS in general.

For example:

I spend 99% of my time in a WSL terminal using tmux + terminal Vim + ranger.
So that takes care of coding and managing files.

Then I use a browser and other graphical apps (image / video editors) that run
directly in Windows.

Dexpot sets up virtual screens with key binds that are comparable to how i3wm
lets you switch and move windows to another screen.

Keypirinha lets you launch apps with a fuzzy finder (like dmenu but better
IMO)

AutoHotkey lets you easily manage global hotkeys (just like i3 does) and more

When you put all of that together, you get a really really good development
experience that also doubles for gaming and running programs that don't have a
good alternative on Linux (such as Camtasia on Windows).

Then for the icing on the cake, since you're running Ubuntu 18.04 in WSL, you
can provision WSL itself with the same exact configuration management scripts
you would use to provision a production box. For me specifically I run all of
the same Ansible roles against WSL that I do in production. I can set the
whole thing up with 1 Ansible command. Plus my dotfiles also happen to work
exactly how they do on my native Linux laptop so it's easy to keep things in
sync and feeling the same.

This all runs from a i5 3.2ghz / 16GB of RAM / SSD / etc. $750 desktop built 5
years ago.

Even if Apple tax didn't exist I would still use this Windows / WSL set up if
I weren't in a position where I could run Linux natively.

------
pixelmonkey
If you run Linux on vanilla Intel ultrabook or Intel desktop/server hardware,
it is not only blazing fast, but all the hardware works out of the box, too.

I wrote about this in the context of Lenovo X1C laptop here:

[http://amontalenti.com/2017/09/01/lenovo-
linux](http://amontalenti.com/2017/09/01/lenovo-linux)

I also recently built a Linux desktop from ~$950 of commodity parts (including
a pair of free GPUs a crypto friend donated to me after his startup died). I
use it as a devserver and a GPU rig for playing with CUDA, PyTorch, and
TensorFlow.

Aside from the requirement of proprietary Nvidia drivers, this whole box works
perfectly in Linux too, is blazing fast, and operates silently and with low
power consumption. (The case itself is bulky, but it’s stationary.) I think an
equivalent Mac would cost a 2-3x multiple and run less well for developer
workloads.

[https://pcpartpicker.com/user/amontalenti/saved/r4rLJx](https://pcpartpicker.com/user/amontalenti/saved/r4rLJx)

Say what you will about Linux, but if you choose your hardware carefully, it
truly does “just work” these days. And you can’t beat having access to
scriptable everything and source code everywhere. That said, I keep a Mac Mini
around because there is some proprietary stuff you can’t avoid in the Apple
ecosystem (e.g. XCode for iOS, Safari Debugger, Keynote/Pages, ...)

------
StillBored
? What I see when I look at that benchmark is a comparison between linux
running in a VM, via WSL and natively.

AKA, VMs are slower than bare metal. News at 10.

Sure there are things windows tends to be slower at, but similarly there are
things linux tends to be slower at. For general desktop usage I think you will
find two things, windows does quite well, and desktop level virtualization
tends to be slower than server virtualization because most desktop users will
be using a virtio/emulation IO access method vs servers which tend to be
punching PCIe adapters into the VMs. Either way, the overhead of additional
translation layers and VM exits for various things is always going to be worse
than just running on bare metal. Wether that works out to barely noticeable
for compute heavy benchmarks that are TLB friendly, 2x for small packet edge
case IO's, or somewhere in between is completely application dependent.

~~~
sams99
WSL is not technically a VM...

The news is not the it is slower, it is how much slower it is. I found the
number surprising given the prevailing wisdom out there was ... sure its
slower, about 5-10% slower.

The other news is that mac is slower and it does not do any virtualising.

~~~
AstralStorm
WSL is quite slow indeed, compared even to a low performance VM like
Virtualbox w/ a bit of hardware help.

Much less to something like KVM with paravirtualization drivers, or even
Hyper-V likewise.

------
underwater
If the time taken to run the test suite is _so_ critical, then how is the
"winning" result of 7m55s any better?

In my experience any multi-minute operation invites a context switch or coffee
break, and end up being roughly equivalent in practice.

~~~
sams99
I completely understand the concern here. If every change required an 8 minute
wait it would be real sad for us.

We use a tool called `rake autospec` at Discourse which is a smart test
runner. I personally like the vim integration we built.

The way it works...

1\. Run `bin/rake autospec` in a terminal 2\. I head to the code I want to
change, I change the code 3\. The spec runner figures out what the right test
is run and runs that. 4\. While it is busy running specs at any time it can be
interrupted by saving a "*.spec" file in which case the spec runner will run
the spec at the cursor

This has worked wonderfully well for us.

~~~
majewsky
FYI, list formatting works best when you leave an empty line between each
item.

1\. just

2\. like

3\. this

------
NightlyDev
I've been using Linux as my main OS for over 10 years now, mainly Ubuntu.

The best part is the performance and a realistic bare metal environment. You
can profile code and actually trust the results. You can't say the same for
virtualizarion, containers or other platforms.

------
snarfy
In the late 90s I installed Slackware on a 386DX 40mhz with kernel 1.2.8,
XFree86, elvis vi clone, etc. I've been using Linux for a long time, on and
off as my main desktop. I have various Linux machines around the house, but
it's not my main desktop today.

There's too much fiddling around to get it working right as a desktop. Audio
has always been a ghetto. Wifi drivers are still binary blobs. Fonts, hidpi,
multi monitor support, wayland, systemd are all still issues today. I really
don't want my development machine to match production. Production is a
stripped down image for a reason. I spend far more time writing code than
running it, so the VM performance hit is a moot point.

To be fair, Windows 10 has plenty of issues of its own that need tweaking,
like having the only way to disable cortana is through group policy edits. And
then they reenable it on the next update, and give me some candy crush ads in
my start menu. It's pretty infuriating, but still less so than manually fixing
wifi drivers through USB boot drives.

------
robocat
It is unfortunate that there is no comparison against an Ubuntu host with an
Ubuntu guest.

"I was paying a pretty high tax for deciding to stick with Windows” was likely
"I was paying a pretty high tax for deciding to use a VM”.

I have little love for Windows, but I would prefer to see numbers that place
the blame correctly.

~~~
ubercow13
Why? The tax is that using Windows means you have to use a VM, not that VMs
are less performant on Windows

~~~
robocat
Well, I use an Ubuntu host on a Dell XPS (since it just works without extra
configuration).

But I also use an Ubuntu guest VM for development so that I can shove the
guest onto a different machine easily (yeah, I know I should use continuous
integration, but I haven't yet).

Using a VM definitely has a big performance cost... Even though I value the
benefits I accept the costs.

~~~
ubercow13
You might be able to use containers on Linux to achieve the same thing without
the performance cost

~~~
robocat
Very likely.

But I know that in X years time I can move a copy of my development VM to run
as a guest on any OS I might happen to use.

I haven't yet spent any time learning how to use containers, or what their
compromises are, so for the moment I am still ignorant of that solution.

------
ryan-allen
> Here I am freaking out about a measly 38% perf hit when I could be running
> stuff concurrently and probably be able to run our entire test suite in 2
> minutes on my current machine on Windows in a VM.

I think this is the point, given you can get an inexpensive desktop CPU with 6
cores and 12 threads, it wouldn't matter so much if you had a 20% perf tax
with WSL when you have approx 12x the throughput.

You could always offload full test suites to an external CI box upon check-in
and work with a subset of unit tests locally, once the suite becomes
prohibitive for a single machine.

------
bluedino
I love OS X, but it's just 'slow'. I have no problem admitting that.

It's much better than it was in the PowerPC days, when (IMO) OS X was almost
too slow to be usable. We have it good these days with faster graphics and
12-core CPU's and super fast SSD's...

But you give these same advantages to Windows/Linux and OS X is just handily
beaten in just about every benchmark you can think of.

------
0x8BADF00D
VM will always be shit at compilation tasks. All of the existing solutions out
there (including Docker) will lead to slower builds, especially if you need to
build an embedded Linux distribution. Native is better, for those tasks.

The haters he’s replying to are literally splitting hairs.

Wow, they shave off 3 mins to run an interpreted language test suite. This is
the ABSOLUTE state of the industry right now.

~~~
jimktrains2
> VM will always be shit at compilation tasks. All of the existing solutions
> out there (including Docker)

Docker isn't a VM; it runs with the same kernel and directly on the host
processor like any application.

~~~
013a
Except the filesystem. Which is what everyone seems to forget. And that's the
big thing we're talking about here in reference to Ruby and tests being slow.

~~~
pmontra
Even if you mount the development directory on the host file system? This is
probably necessary to be able to edit files.

In the case of Ruby maybe you should mount also the language manager directory
with all the gems and the interpreter.

------
impostir
I have been using Linux as my daily driver for a little over 2 years and day
to day, I haven't had practically any problems. Every once in a while, I will
mess with something and then things break, but I know I can fix it. Knowing I
can find a fix to any day to day problem has become absolutely crucial to me;
I can't go back to chasing windows error codes.

------
rcarmo
I’ve been doing an increasing amount of Node development in WSL, and the thing
that helped me the most where it regards disk performance was adding an
exclusion path to Windows Defender so that it wouldn’t constantly scan my WSL
working tree.

Also, I get it that some kinds of testing “feel better” when done locally,
but... why not have those run on a cloud VM?

------
pmontra
Ruby has always been a nightmare on Windows. Every time a new junior freelance
developer is onboarded in a Rails project everybody hopes he's got a Mac or
Linux laptop. A significant number of them uses Windows and we always suggest
them to run a Linux VM. Some of them resist the suggestion. We make clear
we're not wasting time to support their environment (we're deploying on Linux
anyway) and that they are on their own. After not to much time they comply or
leave. After months some of them could even buy a Mac or dual boot on Linux
(Windows is good at videogames.)

Still, AFAIK VirtualBox has a problem with supporting multiple cores. Single
core VM is heavily handicapped even for Ruby. Parallel testing was not in
Rails but it's definitely a thing.

~~~
zubspace
Maybe your company should provide the optimal hardware which everyone must
use? Each employee using a similar environment is a productivity boost. And I
can tell you, that if everyone would use the same system, even windows, you
would have less problems.

Sounds alot simpler than letting everyone use their own environment..

~~~
pmontra
Not my company (I'm a freelancer) and every freelancer brings his own laptop.
Furthermore all of us work from remote, often even employees do. I've seen
this happen everywhere with the small/medium customers I'm working for.

------
ncmncm
It never occurred to him to run Linux on his machine, for real work, and keep
Windows in a VM for when he really needs it?

Surely someone, somewhere has explained that Windows runs faster in a VM than
on bare metal, because Linux is better at file systems and buffer management?
Or that relying on drivers from all over makes your system less reliable than
the fixed set used in the VM?

Me, I cannot imagine running MSWindows on bare metal. It just feels wrong.

------
amanzi
Curious to know why you were using VMware on Windows instead of Hyper-V? I
would expect Hyper-V to be significantly faster than VMware.

~~~
gorjusborg
I gave Hyper-V way too much of my time last tried setting up a development
environment on windows (around September 2018). The Hyper-V tooling just isn't
good enough for the developer use case compared to Virtualbox and VMWare, and
once you enable Hyper-V, it owns the virtualization environment within
Windows, meaning you can't run other hypervisors on the OS. That was a deal-
breaker for me, as Docker for Windows wouldn't even run out of the box.

~~~
vbezhenar
Docker by default runs on Hypet-V.

~~~
bragh
Did it always used to do that, wasn't it VirtualBox only in the beginning?
Also, [https://github.com/MicrosoftDocs/Virtualization-
Documentatio...](https://github.com/MicrosoftDocs/Virtualization-
Documentation/issues/945)

~~~
vbezhenar
I'm not sure about the beginning, but it uses Hyper-V for a while. I don't
know about that bug, I used it with Windows 10 Pro, I guess bugs happens,
probably they will fix it soon if it's widespread. I know that you need a
special Docker package (Docker Toolbox) for VirtualBox and default Docker
package from their website requires Hyper-V.

------
evancox100
Meanwhile, in ASIC/hardware testing land, we're lucky to get a regression
suite done in under 24 hours.

------
mwcampbell
I wonder how big a role Windows Defender, or other antivirus software, plays
in the notorious inefficiency of reading and (especially) writing many small
files on Windows. Sam, did you disable Windows Defender real-time protection,
or add exceptions for it?

~~~
sams99
Absolutely disabled defender.

When I started running the spec suite in WSL, defender went way up (so I gave
it a break), pretty sure stuff would have been way worse with defender on.

The prevailing recommendation though from the WSL team is to leave defender on
for now. So I kind of cheated by disabling it.

------
craz8
I added parallel tests to our app last year. My 4 core/8 thread system runs
the tests pretty well with a process count of 6. The suite runs about 4 times
faster, which makes a real difference

No need to wait for Rails 6 to get this boost

------
lazyjones
Why do people run their server software on their desktop systems instead of,
say, a proper server? Back in the days our desktop systems were VT102s, NCD
X-Terminals or underpowered laptops and developing on the server through
rsh/ssh or even VNC was natural. Does Ruby somehow require locally running GUI
processes?

~~~
mwcampbell
There's certainly nothing stopping you from doing Ruby or JS dev work on a
remote server. I run Windows on my laptop, so when I wanted to start
contributing to Discourse on the side a few months ago, I ordered a VPS at
DigitalOcean and did my work there over SSH. I used SSH tunneling to access
the dev HTTP server.

Edit: It helps that I use vim as my editor.

~~~
pletnes
I’ve done similar things with pycharm. I can run pycharm locally but run a
remote python process. .py files are automatically uploaded and I can debug
over the network just fine. I know eclipse, and presumsbly others, can do the
same.

------
xvilka
By the way, is there something like Discourse but in Go?

~~~
favadi
Why the language matters here?

~~~
scoutt
I don't know on what depends, but I run a small Discourse forum... and I can
tell you is a major PAIN!

I'm not a web developer (I develop mostly firmware) so I'm not into all this
kind of stuff, but I know it is written in Ruby and runs in a Docker
container.

It requires at least 10GB just to be able to install and 20GB just to update
once in a while. It takes ages to compile. It's a PITA to update. Plus docker
gets stuck with old images (not sure it's the right term) and you'll have to
manually clear them.

20GB!! It's a freakin' forum software!!! Some triple A games are around 8GB.

I'm glad someone is asking for alternatives. I think all this overhead is
because maybe redistributing a Ruby website it's a PITA and requires a full
environment installation. And hell yeah I believe a simple test suite can take
10 minutes to run in that poorly conceived environment.

~~~
ksec
It surely doesn't requires 10GB, although it does require a significant amount
of space in Multiple GB due to the way it works in Docker.

May be something could be done to the base image.

Or just try running ./launcher cleanup

~~~
scoutt
I don't want to seem rude, but to my ignorant eyes and those of its users,
it's a forum software that requires a 10GB hard disk to install, and 20GB to
update. I know that there will be a lot of technical details that will justify
(or not) why, but, hey, that's a lot for a forum and there is no sane
alternative way to install it.

I've found that I'm not alone:
[https://meta.discourse.org/search?q=disk%20space](https://meta.discourse.org/search?q=disk%20space)

There are entire pages of users complaining about the same or related
problems.

At the end of the day, it's (almost) free... so what are we complaining for?

~~~
ksec
I know. It surely sounds silly, but my guess is that instead of having to
troubleshoot thousands of different possibl configuration with different
dependency and OS library. The way it is currently distributed is not just
"forum" software, it is the whole OS + Database and All other Software
required along with Backup etc.

------
bgdnyxbjx
This whole Twitter thread and blog post gave me real pause for ever wanting to
work at Discourse.

~~~
mwcampbell
Why, exactly?

