Monday, December 10, 2018

Golang sync.Cond vs. Channel...

The backstory here is that mostly I love the Go programming language.

But I've been very dismayed by certain statements from some of the core Go team members about topics that have significant ramification for my concurrent application design.  Specifically, bold statements to the effect that "channels" are the way to write concurrent programs, and deemphasizing condition variables.  (In one case, there is even a proposal to remove condition variables entirely from Go2!)

The Go Position

Essentially, the Go team believes very strongly in a design principle that can be stated thusly:

"Do not communicate by sharing memory; instead, share memory by communicating."

This design principle underlies the design of channels, which behave very much like UNIX pipes, although there are some very surprising semantics associated with channels, which I have found limiting over the years.  More on that below.

Certainly, if you can avoid having shared memory state, but instead pass your entire state between cooperating parties, this leads to a simpler, lock free (sort of -- channels have their own locks under the hood!) design.  When your work is easily expressed as a pattern of pipelines, this is a better design.

The Real World

The problem is that sometimes (frequently in the real world) your design cannot be expressed this way.   Imagine a game engine, dealing with events from the network,  multiple players, input sources, physics, modeling, etc.  One simple design is to use a single engine model, with a single go routine, and have events come in via many channels.  Then you have to create a giant select loop to consume events.  This is typical of large event driven systems.

There are some problems with this model.

  1.  Adding channels dynamically just isn't really possible, because you have a single hard coded select loop.  Which means you can't always cope with changes in the real world.   (For example, if you have a channel for inputs, what happens when someone plugs in a new controller?)
  2. Any processing that has to be done on your common state needs to be in that giant event loop.  For example, updates to lighting effects because of an in game event like a laser beam needs to know lots of things about the model -- the starting point of the laser beam, the position of any possible objects in the path of the laser, and so forth.  And then this can update the state model with things like whether the beam hit an object, causing a player kill, etc.
  3. Consequently, it is somewhere between difficult and impossible to really engage multiple CPU cores in this model.  (Modern multithreaded games may have an event loop, but they will also make heavy use of locks to access shared state, in order to permit physics calculations and such to be done in parallel with other tasks.)

So in the real world, we sometimes have to share memory still.

Limitations of Channels

There are some other specific problems with channels as well.

  • Closed channels cannot be closed again (panic if you do), and writing to a closed channel panics. 
  • This means that you cannot easily use go channels with multiple writers.  Instead, you have to orchestrate closing the channel with some other outside synchronization primitive, such as a mutex and flag, or a wait group.)  This semantic also means that close() is not idempotent.  That's a really unfortunate design choice.
  • It's not possible to broadcast to multiple readers simultaneously with a channel other than by closing it.  For example, if I am going to want to wake a bunch of readers simultaneously (such as to notify multiple client applications about a significant change in a global status), I have no easy way to do that.  I either need to have separate channels for each waiter, or I need to hack together something else (for example adding a mutex, and allocating a fresh replacement channel each time I need to do a broadcast.  The mutex has to be used so that waiters know to rescan for a changed channel, and to ensure that if there are multiple signalers, I don't wake them all.)
  • Channels are slow.  More correctly, select with multiple channels is slow.  This means that designs where I have multiple potential "wakers" (for different events) require the use of separate channels, with separate cases within a select statement.  For performance sensitive work, the cost of adding a single additional case to a select statement was found to be quite measurable.
There are other things about channels that are unfortunate (for example no way to peek, or to return an object to channel), but not necessarily fatal.

What does concern me is the false belief that I think the Go maintainers are expressing, that channels are a kind of panacea for concurrency problems.

Can you convert any program that uses shared state into one that uses channels instead?  Probably.

Would you want to?  No.  For many kinds of problems, the constructs you have to create to make this work, such as passing around channels of channels, allocating new channels for each operation, etc. are fundamentally harder to understand, less performant, and more fragile than a simpler design making use of a single mutex and a condition variable would be.

Others have written on this as well.

Channels Are Not A Universal Cure

It has been said before that the Go folks are guilty of ignoring the work that has been done in operating systems for the past several decades (or maybe rather of being guilty of NIH). I believe that the attempt to push channels as the solution over all others is another sign of this.  We (in the operating system development community) have ample experience using threads (true concurrency), mutexes, and condition variables to solve large numbers of problems with real concurrency for decades, and doing so scalably

It takes a lot of hubris for the Golang team to say we've all been doing it wrong the entire time.  Indeed, if you look for condition variables in the implementation of the standard Go APIs, you will find them.  Really, this is a tool in the toolbox, and a useful one, and I personally find it a bit insulting that the Go team seems to treat this as a tool with sharp edges with which I can't really be trusted.

I also think there is a recurring disease in our industry to try to find a single approach as a silver bullet for all problems -- and this is definitely a case in point.  Mature software engineers understand that there are many different problems, and different tools to solve them, and should be trusted to understand when a certain tool is or is not appropriate.

Saturday, December 1, 2018

Go modules, so much promise, so much busted

Folks who follow me may know that Go is one of my favorite programming languages.  The ethos of Go has historically been closer to that of C, but seems mostly to try to improve on the things that make C less than ideal for lots of projects.

One of the challenges that Go has always had is it's very weak support for versioning, dependency management, and vendoring.  The Go team's historic promise and premise (called the Go1 Promise) was that the latest version in any repo should always be preferred. This has a few ramifications:

  • No breaking changes permitted in a library, or package, ever.
  • The package should be "bug-free" at master.  (I.e. regression free.)
  • The package should live forever.

For small projects, these are noble goals, but over time it's been well demonstrated that this doesn't work. APIs just too often need to evolve (perhaps to correct earlier mistakes) in incompatible ways. Sometimes its easier to discard an older API than to update it to support new directions.

Various 3rd party solutions, such as, have been offered to deal with this, by providing some form of semantic versioning support.

Recently, go1.11 was released with an opt-in new feature called "modules".  The premise here is to provide a way for packages to manage dependencies, and to break away from the historic pain point of $GOPATH.

Unfortunately, with go modules, they have basically tossed the Go1 promise out the window. 

Packages that have a v2 in their import URL (like my mangos version 2 package) are assumed to have certain layouts, and are required to have a new go.mod module file to be importable in any project using modules.  This is a new, unannounced requirement, and it broke my project from being used with any other code that wants to use modules.  (As of right now this is still broken.)

At the moment, I'm believing that there is no way to correct my repository so that it will be importable by both old code, and new code, using the same import URL.  The "magical" handling of "v2" in the import path seems to preclude this.  (I suspect that I probably need different contradictory lines in my HTML file that I use to pass "go-imports", depending on whether someone is using the new style go modules, or the old style $GOPATH imports.)

The old way of looking at vendored code is no longer used.  (You can opt-in to it if you want still.)

It's entirely unclear how godoc is meant to operate the presence of modules.  I was trying to setup a new repo for a v2 that might be module safe, but I have no idea how to direct godoc at a specific branch.  Google and go help doc were unhelpful in explaining this.

This is all rather frustrating, because getting away from $GOPATH seems to be such a good thing.

At any rate, it seems that go's modules are not yet fully baked.  I hope that they figure out a way for existing packages to automatically be supported without requiring reorganizing repos.  (I realize that this is already true for most packages, but for some -- like my mangos/v2 package -- that doesn't seem to hold true).

Tuesday, June 19, 2018

Letter to Duncan Hunter (Immigration)

(Congressman Duncan Hunter is my Representative in the House.  Today I sent the letter below to him through the congressional email posting service (which verifies that I'm his constituent).  A copy is here for others to read.  I encourage everyone, especially those in districts with Republican congressional representation to write a similar letter and send it to their congressman via the site at -- you can look up your own representative on the same site.)

Congressman Hunter,

I have read your "position" statement with respect to the administrations "Zero Tolerance" treatment towards immigration, and the separation of families seeking asylum, and I am *most* dismayed by the position you have taken.

I would encourage you to start by reading the full text of the following court order, which describes the reprehensible actions taken by the administration:

This is not hearsay, but legal findings by a US Court.

Your claim that "most asylum seekers" are not being broken up is disturbing, because it also indicates that you believe it is okay to separate families "sometimes".  The reality is that there are cases where separation is warranted to protect the children, but there is ample evidence that this is not the case in many of these separations.  (See the above court case.)

Not only that, but we know of cases where families have been separated for doing nothing wrong than presenting themselves fully legally at a border crossing and petitioning for asylum.

Even in misdemeanor cases of illegal entry, the punishment of breaking families up -- while both children and parents are held separately for deportation proceedings, is both cruel and unusual punishment, and entirely unnecessary.

It is also my belief that these separations create more risk to the United States, making us less safe.  Some of these children will remember the horrible ways that they were treated as criminals by our country.  How many will radicalize as a result later in life?  Just one is too many, and utterly unnecessary.

Furthermore, the use of the misery of these families as some kind of political card to achieve ends is both morally reprehensible and of dubious value -- the border wall is a boondoggle and will have little effective value. The real problem of immigration is the attraction of millions of jobs -- jobs that should be filled *legally*.  (So mandatory eVerify, with criminal prosecution against *EMPLOYERS* who violate rather than against poor immigrants is the real fix to that problem.  You backed mandatory eVerify, an action which I applaud.)

The ends -- a border wall -- do NOT justify the means, which have been amply and justifiably compared with the approach used by Nazi Germany in the 1930s, when dealing with Jewish families.

As a nation we are embarrassed by our Internment of Japanese Americans during the same time frame, and the US government has been called to account for that in the past.  Yet even in the midst of world war our leaders did not stoop to separating parents from the children, or to use children as some kind of pawns in a larger political scheme.

Indeed, these actions are more akin to those used by terrorists -- literally using "terror" (in this case fear of breaking a family up, which any parent knows is amongst the most terrible things to be contemplated) to achieve political ends.

Please think long and hard about your decision to stand with Trump in this regard.  If you stand with him here -- as an agent of terror and tyranny, then I cannot in good conscience stand with you.

You have a unique opportunity to break from the party lines, and demonstrate moral courage here -- an opportunity which if taken would certainly win back my support.   Or you can side with forces evil in supporting actions that numerous industry and business leaders have called "morally reprehensible" and "inhumane".

The choice is yours to make.  For now.

Saturday, June 9, 2018

Self Publishing Lessons

Over the past several weeks I've learned far more than I ever wanted to about the self publishing process.  I'm posting some of my findings here in the hopes that they may help others. 


If you're going with eBooks, and you should, consider using an author website to sell it "early", and once your book is finished publish it with Kindle Direct Publishing and Smashwords.  Keep the author website / store up even after, so you can maximize returns.  Price your eBook between $2.99 and $9.99.

If you're going to go with Print, start with Amazon Kindle Direct Publishing first, unless you're only needing a small run of books printed only in the USA (in which case looks good).  Once you're book is really done, and you're ready to branch out to see it available internationally and from other bookstores, publish it with Ingram Spark.

Get and use your own ISBNs (From -- buy 10 at a time), and make sure you opt out of Kindle Select!

More details are below.

eBook Formats

Let's start with ebook formats first.  Be aware that I'm writing this from California, with no "nexus" elsewhere, and electronic goods (when they are purely electronic) are not taxable here.  That means I haven't worried much about accounting for VAT or Sales Tax, because I don't have to.


Leanpub is how I started out, but they've altered there terms several times.  Right now their royalties are not substantially less than anyone else (they used to be), and you can get an even higher return selling through your own store (such as  The one thing they have over everyone else is their Markua tools, and their focus on helping authors in the early stages -- you can "publish" before the book is complete on Leanpub.  I'm not sure how useful Markua is to other people -- I don't use it at all.  If you have a book in progress, this will let you sell copies early.  But, they do take a cut -- 80%. Frankly, their business model seems a bit iffy right now, and I wouldn't like to put too many eggs in that basket.  You won't need an ISBN at Leanpub.  They pay 80% royalties, allow free updates (to a limit most authors are unlikely to hit).  Leanpub has very limited reach, and doesn't distribute to anywhere else.

Author Website

The cheapest and most cost effective way to sell your ebooks is to open your own author store.  Sites like will let you do this for free, and only charge reasonable transaction fees.  With this approach you can get about 95% of the book sales.  You can publish as soon as you want, send updates as often as you want, and don't need ISBNs or anything like that. On the downside, you have to do a little more work to set things up.  You'll also have limited reach, and pretty much look like a fly by night operation.  If you want to "pre-publish" before a work is complete, this is a way to do that, without paying that 20% to Leanpub.  You can also leave this store open, and point to it from your personal author pages, even after you are working with the larger distributers.

Ingram Spark

Ingram Spark's ebook distribution service gets broad reach through relationships with the various outlets.  You can use them to get to Apple, Kobo, even Amazon.  And yet I would not recommend doing this.  First off they charge to set up the book, typically $25.  Then if you want to make a revision to the book, it's another $25.  And then you're typically going to set it up so that you get only 45% of the royalties (or 40% if you really messed up and didn't opt out of the Amazon agreement.) . Furthermore, I found that their conversion of my ePub to Kindle format was inferior, leading to a poor reading experience on those devices.  (I have some complex layout, and custom fonts, as the book is technical in nature.)   I had much better luck generating my own .mobi format and working with Amazon directly.   Their service takes forever to get back to you -- I'm still waiting while I try to remove my eBook from their distribution.  In short, I would not use Ingram Spark for eBook.  You also will need an ISBN if you use Ingram Spark.

Amazon (Kindle Direct Publishing)

Using the Kindle Direct Publishing was pretty easy, and this let me provide a .mobi file that was optimized for Kindle, addressing issues caused by converting from ePub.  (To be fair most authors won't have these problems.)  If you want to reach Kindle readers (and you do!), you should just set up a KDP account.  One word though -- don't opt-in to Kindle Select!!  Amazon is great, for distributing to Amazon customers.  But you don't want to give away your exclusivity.    There is a weird set of rules about royalties with KDP though.  If you want to get their best 70% (which won't be in all markets, but the main ones) you need to set your List Price between $2.99 and $9.99, inclusive.  (Other values are used for other currencies.)  Deducted from your 70% rate is the cost to transfer the data to the user, which turns out to be pretty cheap -- less than a dollar typically.  (But if you're only selling a $2.99 book, make sure you keep the file sizes down, or this will hurt your rates.)  You can opt for a flat 35% royalty instead, which might make sense if your book is heavy on content, and its required if your book is outside the price points.  (This is why you never see ebooks listed for $11.99 or something like that on Amazon.)


I just set up my account with Smashwords, and I'm thrilled so far.  It looks like you'll get about 80% royalties through their own store, and 60% if your book is bought through one of their partners -- which includes just about everyone -- including Apple, GooglePlay, Kobo, etc.  This gets you pretty much everywhere, except Amazon.  But you did set up a KDP account already right?  They take the royalty, and you're done.  There is one fairly severe draw back to Smashwords -- they want you to upload your manuscript as a specially formatted Word document.  (They do have direct ePub though, which you can use if you want.  I did this because I don't have a Word version of my book, and it would be difficult to get one -- it was authored in Asciidoctor.)   You will need an ISBN to get into their expanded distribution program, of course.  They will offer to sell you one, but I recommend you not do that and use your own.  (Especially if you're uploading your own ePub.)

Direct Retailer Accounts

You can maximize royalties by setting up direct accounts with companies like Apple, Kobo,  and Barnes&Noble.  In my experience, it just isn't worth it.  Dealing with these all is a headache, and it takes forever.  Some, like Google Play Store, are almost impossible to get into.  As the list gets large, the percentage of your distribution that are covered here diminishes, consider whether that extra 10% royalty rate is worth the headache.  Some of these will need ISBNs, and the pricing and royalties will all vary of course.

Printed Books

If you've spent a lot of time making a great book, you probably want to see it in print format, right?  Nothing is quite the same to an author as being asked to sign a physical copy of professionally bound book of their own work.  Note that it takes some extra effort to set up a book for print -- you'll need to ensure that you have a press-ready PDF (I had to purchase a copy of Adobe Acrobat DC so that I could properly preflight my files), and setting up the cover can be a challenge if you're not a designer.

Note that details such as print margins, paper weight, and hence cover sizes, can vary between the different printers.  Be prepared to spend a lot of time if you decide to go down this road, and to have to spend a lot of time for each printer you use.

After doing some research, I decided to give these guys a shot at printing my first version.  I was really impressed with the quality -- while the first printing of my book had a number of issues, none of them were the fault of TheBookPatch -- they were all on me.  The problem with these guys is that they are tiny.  Almost nobody has ever heard of them, and you won't get be getting this listed at places like Barnes&Noble.  Additionally, they are rather expensive, particularly if you want to send books to places overseas.  At one point I wanted to send one copy of my book to the Netherlands.  The shipping cost was going to be about $80.  Needless to say, my relationship with TheBookPatch came to an abrupt end.  (I'd still recommend giving these guys a shot if you're printing books for your own use here in the USA.)   One big advantage is that they were able to put together an attractive cover using their website cover designer, with no special skills.  You also don't need an ISBN to print through

Ingram Spark

Ingram Spark has the best rates internationally, and is reputed to have excellent print quality.  My book is available from them.  They charge $49 to set it up, and $25 for updates.  This is super annoying, so I wouldn't publish with them until and unless you know that you're ready and need international distribution or want to see your printed book available via Barnes&Noble or other retailers.  They're also slow.  I ordered 3 copies of my book a week ago, and they only confirmed that they are shipping them today.  If you're serious about selling printed books widely, I would definitely go with them.  But unless you anticipate the volume, I'd hold off.  You will need an ISBN as well.  With Ingram Spark, you set up your royalty rates which are usually 45% of net.   Typically this means you'll get something like a 20-25% actual royalty, depending on the book.

Amazon KDP

Now available for authors, you can use Amazon Print on Demand.  After setting up the layout, and doing the work to ensure the quality is good -- which can take some effort -- it's pretty easy.  Amazon will sell you an ISBN if you want one -- I'm not sure if they are required for print books or not.  (I already had one from my Ingram Spark journey.)  Amazon gives a much better royalty, of 60% of net, and their printing costs for small runs seem to be fairly inexpensive, as is shipping.  For example, my 430 page, 2 lb (7.5"x9.25" paperback) book cost about $6 to print, and about $10 to ship.  That means that as my list price is $49.95, I can expect to receive about $20.  Amazon will cut into their own margins to discount the book as well, to optimize the price.  Having said all that, I'm still waiting for my proof, which Amazon apologized for taking an extra day or two to print -- I should be getting it in a couple of days (I opted for the cheap shipping -- you can't use your Prime account to ship author proofs which are made available to you at cost).  Their paper is thicker than Ingram's and so I had to redesign the cover, and their margins are stricter (my page numbers fell outside their strict .5" margins), so I wound up having to re-do the whole layout.  It would have been better if I had started with Amazon first.

There are other print-on-demand players, but I've heard enough complaints about print quality when using them, that I just avoided them.  After all, if you're bothering to put your book into print, you want the results to reflect all the effort you put into it.

Monday, June 4, 2018

Altering the deal... again....

(No, this is not about GitHub or Microsoft... lol.)

Back in March (just a few months ago), I signed up on Leanpub to publish the NNG Reference Manual.  I was completely in the dark about how to go about self-publishing a book, and a community member pointed me at Leanpub.

Leanpub charged $99 to set up, back in March, and offered a 90% (minus 50 cents) royalty rate.  On top of it they let me choose a price from free, or $0.99 to $99.  Buyers could choose within that range.  This looked great, although I was a bit hesitant to spend the $99 since there was no way to try their platform out.

Note that at this time I was not interested (and am still not interested) in their authoring tools based on Markua.  I had excellent tooling already in Asciidoctor, plus a bunch of home-grown tools (that I've since further expanded upon) to markup and layout the book, plus previewing, etc.

Everything was great, and I made sales ranging from $0.99 to $20.  Not a lot of sales, but enough to nearly recoup my $99 investment.  Now, I wasn't looking at this as a money making venture, but as a way to help support my work around NNG -- having a professionally produced reference manual was something I considered an important step for NNG.

Shortly after I created the book and published, Leanpub changed the minimum price that buyers could pay to $4.99.  We're talking about a digital good here.  First time the deal was altered....

Then in April, they introduced a new SaaS pricing model, where I could have ditched the $99 fee.  So I'm feeling like a chump, but hey at least I have that 90% royalty rate, right?  (By this time I'd sold enough to cover that initial $99 outlay, thanks to generous supporters from the NNG community.) . Deal altered again.

Then they introduced a freemium model in May, where I really could have skipped that $99 outlay.  But they told me that I was grandfathered, so I could keep my 90% rate, so I was getting something for that $99 I spent originally.  Deal altered third time?

Now, they've told me that they've changed their mind, and no, they aren't going to let me keep that grandfathered rate.  Deal altered again?!?

They posted a long essay explaining why they "had" to do this.  I get it, their old business model wasn't working.  But in the past 3 months they've made not one, not two, but three changes to their pricing and business model.  They've made promises, and gone back on their word.

But it's ok, because at 80% I'm making more than with Amazon, right?  Well, no, not really.  I won't repeat the calculations here, but it turns out that I would have made slightly more money with Amazon.  Now, that's partly due to the fact that my sales have been quite slow (as they were predicted to be -- this is a really niche book -- a reference manual for a product that isn't even 1.0 yet.)

The thing is, I'm slightly irked about the loss of income, but I'm much more angry about the lack of respect they've given us, their authors and customers.  Clearly, their promises don't carry much weight.  They've offered lifetime free Pro accounts to customers who were with them long enough to have at least $500 in royalties, but everyone else is out of luck.  As to those lifetime pro accounts -- well, it's "lifetime, or until we change our mind".   Which seems to occur about once a month.

Now Leanpub isn't some big bad company, but their attitude and thinking reflected in how they've handled this process shows clear alignment with the same thought processes that those big bad companies have.  As an author you're not a valued partner to them -- you're a source of revenue, with very little effort on their part required to support you.

I've started rethinking my use of Leanpub obviously.

It seems like I can make use of Selz which seems to have really good support for selling digital goods like eBooks (and even has a Pay What You Want option!), and with my small number of digital goods will only charge me the transaction processing costs -- either 2.9% or 3.9% depending on location.  (Digital goods are not taxable in California.)  So what was I gaining from Leanpub again?

For Kindle and iBooks, it also looks like dealing with Amazon and Apple directly look like a better deal than Leanpub.  You get their expanded distribution, and yes, you only get 70% royalties, but you don't have to pay any recurring fees.  Unless you're doing large volumes, the math on these works out better than any of the Leanpub paid plans.

 (IngramSpark, where I have also posted the book, also works, but I've had less than satisfactory results with their epub->mobi conversion, so I can't recommend using them for Kindle at least, and I think the royalties you get from dealing directly with Apple are superior anyway.)

This all seems like a lot of work, but I hope this helps other authors who might be considering using Leanpub.

(There is one feature which is nice on Leanpub, which is the ability to publish an incomplete work in progress, and then keep updating it.  But let's face it, you can do that equally well from your own website and something like Selz.)

Not Abandoning GitHub *yet*

The developer crowds are swarming off of GitHub in the wake of today's announcement that Microsoft has agreed to purchase GH for $7.5B.

I've already written why I think this acquisition is good for neither GitHub nor Microsoft.  I don't think it's good for anyone else either... but maybe at least it alerts us all to the dangers of having all our eggs in the same basket.

At the moment my repositories will not be moving.  The reason for this is quite simple -- while the masses race off of GitHub, desperate for another safe harbor, the panic that this has created is overwhelming alternative providers.  GitLab reported a 10X growth.  While this might be good for GitLab, its not good for people already on GitLab, as there was already quite a well understand performance concern around

At least in the short term, GitHub's load will decrease (at least once all the code repo exports are done), I think. 

The other thing is that Microsoft has come out and made some pretty strong promises about not altering the GitHub premise, and the "new leadership" over there is ostensibly quite different from the old.  (Having said that, there is a lot of bad blood and history between FOSS and Microsoft. A lot of the current generation of millenials don't have that history, but some of us haven't forgotten when Steve Ballmer famously said "Linux is a cancer", and when Microsoft used every dirty trick in the book to try to kill all competitors, including open source software.  If Microsoft had had its way back in the 90s and 00s, the Internet would have been a company shanty-town, and Linus Torvalds would have been a refugee outlaw.

Thankfully that didn't happen.

Microsoft is trying to clean its image up, and maybe it is reformed now, but the thing we all have to remember is that Microsoft is beholden first, foremost, and exclusively to it's shareholders.  Rehabiliting it's image is critical to business success today, but at it's roots Microsoft still has those same obligations.)

The past couple of years of good behavior doesn't undo decades of rottenness; many of us would have been thrilled to see Microsoft enter chapter 11 as the just dessert for its prior actions.

Microsoft was losing mindshare to OSS and software like Git (and companies like GitHub). Purchasing GitHub is clearly an effort to become relevant again.   The real proof will be seen if Microsoft and GitHub are still as FOSS friendly in two years as they are today.  Promises made today are cheap.

But I'm willing to let them have the benefit of the doubt, understanding that I retain my options to depart at any time.  I won't be creating *new* repositories there, and my private one's will be moving off of GitHub because I don't want Microsoft to have access to my proprietary work.  (Probably they can still get it from backups at GitHub, but we do what we can...)

But my open source stuff is still there.  For now.

That means mangos, NNG, nanomsg, and tcell remain.  For now.

It's up to Microsoft and GitHub to see if they stay.

 - Garrett

Sunday, June 3, 2018

Microsoft Buying GitHub Would be Bad

So apparently Microsoft wants to buy GitHub.

This is a huge mistake for both companies, and would be tragic for pretty much everyone involved.

GitHub has become the open source hosting site for code, and for a number of companies, it also hosts private repositories.  It's the place to be if you want your code to be found and used by other developers, and frankly, its so much of a de facto standard for this purpose that many tools and services work better with GitHub.

GitHub was founded on the back of Git, which was invented by Linus Torvalds to solve source code management woes for the Linux kernel. (Previously the kernel used an excellent tool called BitKeeper for this job, but some missteps by the owners of BitKeeper drove the Linux team away from it.  It looks like GitHub is making similar, albeit different, commercial missteps.)

Microsoft already has their own product, Visual Studio Team Services, which competes with GitHub, but which frankly appeals mostly to Microsoft's own developer base.  I don't think it is widely used by Linux developers for example.

Implications for Open Source

Microsoft has been much more "open source friendly" of late, but I have to admit I still don't trust them.  I'm hardly alone in this.

It also is a breach of sorts of an unwritten trust that the open source community has placed in them.  There is much bad blood between Microsoft and open source software.  Many of the most treasured open source systems exist directly in conflict to proprietary systems.  Think about software like Samba, and Wine and OpenOffice.  These were created as alternatives to Microsoft.  Being acquired by Microsoft means that these projects will feel compelled to abandon GitHub.

As this happens, many tools and services that offer services that are tailored to GitHub (automated code review, CI/CD, etc.) are going to be rushing to find a way to offer services for alternatives, as their client base runs screaming from GitHub.  (Back in February of 2016 I tried to leave GitHub, because of philosophical differences of opinion with their leadership.  I abandoned the effort after discovering that too many of the external support services I used for these open source projects were either GitHub only, or could only be converted away from GitHub with large amounts of additional effort and big negative impact for my users.)

This is a watershed moment for GitHub.
I predict in as little as 6 months nobody will be creating new open source projects on GitHub.

Unfortunately, it's probably already too late for GitHub.  Unless they were to come out and immediately deny any acquisition attempts, and make some public announcements recognizing the trust they've been given, and asserting the importance of honoring it, nobody will trust them any more.

Implications for Commercial Use

This is also going to harm commercial customers, driving them away.

Microsoft has many commercial ventures which overlap with those of almost everyone doing anything in software.  GitHub being acquired by Microsoft will in one fell swoop make GitHub a direct competitor with vast amounts of their own customer base.  (Essentially, your either a Microsoft competitor, or a partner.  And often both.)

If you're using GitHub for private repositories, it probably is time to rethink that.  Unless you trust Microsoft not to do evil.  (They've never even made any such promises.)  This also means, I think that it might be time to reconsider hosting your private data with anyone else.  GitLab and BitBucket look better to be sure, but what's to prevent another large company from acquiring them?

It's time to reconsider the cost of hosting in the cloud.  I've been expecting a move back to on-premises storage and hosting for some time now, but this will only accelerate that.

Implications for Microsoft

Microsoft will spend quite a lot of money to acquire GitHub.  But instead of acquiring a goose that lays golden eggs, they are going to have one that needs to be fed and turns that into fecal material.

At the same time, while this may help bolster some of the technology in VSTS in the short term, the reality is that most of the best stuff isn't that hard to build, and most of what GitHub has can be done on any cloud based system with sufficient storage and compute.  Most of their tech is not tied to Windows, almost certainly.

The VSTS team will no doubt be impacted, and there will be a lot of pain and suffering attempting to more tightly integrate VSTS with the new adopted child.  I'm sure there are redundancies that will be eliminated, but I expect part of what is going to happen is a shift in focus from providing the best experience for Visual Studio developers and making things work well on Azure, to figuring out how to more tightly integrate GitHub's toolset into theirs.  Can you imagine trying to reconcile the differences between VSTS and GitHub's issue tracking systems?  Yikes!

The uncertainty will annoy customers, and I suspect will drive them away from the existing VSTS stack.  Whey they leave, they probably won't be moving to GitHub.

Like the proverbial dog with the bone looking at his reflection in the water while on the bridge, instead of having one bone, Microsoft's greed will leave it with none (at least in this space.)

I'm sure that the founders and investors of GitHub will make a mint taking Microsoft's money.  Normally I'd applaud anyone with plans to part Microsoft from some of it's funds.  But this move is just plain bad business.

Anti-Trust Violations?

As I mentioned above, Microsoft has their own product, Visual Studio Team Services, which competes with GitHub.  This alleged acquisition of GitHub seems to me to fly in the face of anti-trust rules.  Microsoft clearly has been trying to make inroads into the open source community with projects like Visual Studio Code and Linux support for VSTS, so I would hope that the regulatory bodies involved would examine this with great scrutiny.

Of course, if GitHub is for sale, many of the same concerns except the antitrust legislation would apply.  It would be a Bad Thing (tm) if GitHub were to be acquired by Facebook, Google, or Amazon, for example, for most of the same reasons that being acquired by Microsoft would be bad.

Now please pardon me while I go back to setting up gogs on my own systems...

Tuesday, May 22, 2018

No, Nanomsg is NOT dead

There seems to have been some pretty misleading data out on the Internet, indicating that "nanomsg is dead".  The main culprit here is a "postmortem" by Drew Crawford.  Unfortunately comments are apparently not working on that post according to Drew himself.

The thing is this (apologies to Samuel Clemens):  "reports of the death of nanomsg have been greatly exaggerated".

So it's time to set the record straight.

I've been working hard on nanomsg, and the Scalability Protocols that are intrinsic to nanomsg for quite some time.  It has been generally occupied my full time paid job for approximately the past year.  I've been working on this stuff part time for longer than that.

The main focus during this time has been a complete rewrite of the core library, known as NNG.  NNG, or nanomsg-next-gen, aims to be a far superior version of nanomsg, with significant new capabilities, greatly improved reliability, scalability, extensibility, and maintainability.  It is wire compatible with legacy nanomsg and mangos, and retains a backwards compatible API (though it also offers a newer API which should be quite a lot easier to use).

During all this time, I've continued to act as the maintainer for nanomsg, although at this point I'd say that nanomsg itself is in sustaining mode, as I'm very focused on having NNG stand in as a full replacement for nanomsg.

We've also published the first NNG book, which is really just the reference manual.  There are over 400 pages (actually about 650 in the 7.5"x9.25" printed edition, which I've not put up yet) of detailed API documentation available.  (Let me know if you're interested in the print edition -- it costs me about $35 to produce, but I'm willing to make it available for folks that are willing to pay for it.  Admittedly the electronic version is probably a lot more useful since it has working hyperlinks and supports searching.)  Oh, and by the way, the book also covers the legacy API used with legacy libnanomsg.

I'm working on the second NNG book, which will be much more of a "how-to" (backed up with case studies and code) now.  (This will take some time to come to market.  At the moment these books are a secondary effort, since the time spent on them is time spent away from working on the code itself or on related commercial activities.)

There have been more contributors to NNG of late, and interest is picking up as NNG itself is already on final countdown for its FCS approach.  (The first beta release, 1.0.0-beta.1 was released last week.  I expect to release a 2nd beta today, and then the final release will probably come a week or so later, depending upon beta test results of course.)

The work I've done for NNG has also inspired me to make further improvements to mangos.  Over the course of the next few months you can expect to see further harmonization between these two projects as NNG gains support for the STAR protocol from mangos, and mangos gains some new capabilities (such as optional separable contexts to enable much easier development of concurrent applications.)

So, if you've heard that "nanomsg is dead", now you know better.  In fact, I'd venture to say that the project is healthier and more alive than it ever was.

Furthermore, in many respects the new NNG project is far more robust, scalable, and stable than I believe nanomsg or ZeroMQ have ever been.  (This because NNG has been designed with a serious eye towards production readiness from the first line of code.  Every error case is carefully considered.)

If you haven't looked at any this stuff lately, give it another look!

Tuesday, January 23, 2018

Why I'm Boycotting Crypto Currencies

Unless you've been living under a rock somewhere, you probably have heard about the crypto currency called "Bitcoin".  Lately its skyrocketed in "value", and a number of other currencies based on similar mathematics have also arisen.  Collectively, these are termed cryptocurrencies.

The idea behind them is fairly ingenious, and based upon the idea that by solving "hard" problems (in terms of mathematics), the currency can limit how many "coins" are introduced into the economy.  Both the math and the social experiment behind them is something that on paper looks really interesting.

The problem is that the explosion of value has created a number of problems, and as a result I won't be accepting any of these forms of currencies for the foreseeable future.

First, the market for each of these currencies is controlled by a relatively small number of individuals who own a majority of the outstanding "coins".  The problem with this is that by collusion, these individuals can generate "fake" transactions, which appear to drive up demand on the coins, and thus lead to a higher "value" (in terms of what people might be willing to pay).  The problem is that this is a "bubble", and the bottom will fall right out if enough people try to sell their coins for hard currency.  As a result, I believe that the value of the coins is completely artificial, and while a few people might convert some of these coins into hard cash for a nice profit, the majority of coin holders are going to be left out in the cold.

Second, the "cost" of performing transactions for some of these currencies is becoming prohibitively expensive.  With most transactions of real currency, its just a matter of giving someone paper currency, or running an electronic transaction that normally completes in milliseconds.  Because of the math associated with cryptocurrencies, the work to sign block chains becomes prohibitive, such that for some currencies transactions can take a lot of time -- and processors are now nearly obliged to charge what would be extortionary rates just to cover their own costs (in terms of electricity and processing power used).

The environmental impact, and monumental waste, caused by cryptocurrencies cannot be overstated.  We now have huge farms of machines running, consuming vast amounts of power, performing no useful work except to "mine" coins.  As time goes on, the amount of work needed to mine each coin grows significantly (an intentional aspect of the coin), but what this means is that we are burning large amounts of power (much of which is fossil-fuel generated!) to perform work that has no useful practical purpose.   Some might say something similar about mining precious metals or gems, but their a many many real practical applications for metals like gold, silver, and platinum, and gems like diamonds and rubies as well.

Finally, as anyone who wants to build a new PC probably realizes, the use of computing hardware, and specifically "GPUs" (graphical processing units, but which also can be used to solve many numerical problems in parallel) have increased in cost dramatically -- consumer grade GPUs are generally only available today for about 2x-3x their MSRPs.  This is because the "miners" of cryptocurrencies have snapped up every available GPU.  The upshot of this is that the supply of this hardware has become prohibitive for hobbyists and professionals alike.  Indeed, much of this hardware would be far far better used in HPC arenas where it could be used to solve real-world problems, like genomic research towards finding a cure for cancer, or protein folding, or any number of other interesting and useful problems which solving would benefit mankind as a whole.  It would not surprise me if a number of new HPC projects have been canceled or put on hold simply because the supply of suitable GPU hardware has been exhausted, and putting some of those projects out of budget reach.

Eventually, when the bottom does fall out of those cryptocurrencies, all that GPU hardware will probably wind up filling land-fills, as many people won't want to buy used GPUs, which may (or may not) have had their lifespans shortened.  (One hopes that at least the eWaste these cause will be recycled, but we know that much eWaste winds up in landfills in third world countries.)

Crypto-curency mining is probably one of the most self-serving and irresponsible (to humanity and our environment) activities one can take today, while still staying in the confines of the law (except in a few jurisdictions which have sensibly outlawed cryptocurrencies.)

It's my firm belief that the world would be far better off if crypto-currencies had never been invented.