Saturday, July 13, 2019

Fermat's Last Theorem

Somehow, I happened across a beat-up, weathered copy of Amir Aczel's Fermat's Last Theorem just before a long airplane trip, and so I happily accepted the gift.

Aczel has written a number of "popular mathematics" books; I think this was one of his first books.

Fermat's Last Theorem, of course, is a wonderful topic, and perhaps one of the best topics for a popular mathematics book, starting from its origin story in Pierre de Fermat's notebooks ("I have discovered a truly remarkable proof of this theorem which this margin is too small to contain") to the marvelous work of Andrew Wiles, who was a great source of quotations himself:

Perhaps I could best describe my experience of doing mathematics in terms of entering a dark mansion. You go into the first room and it's dark, completely dark. You stumble around, bumping into the furniture. Gradually, you learn where each piece of furniture is. And finally, after six months or so, you find the light switch and turn it on. Suddenly it's all illuminated and you can see exactly where you were. Then you enter the next dark room...

(Wiles's evocative quote is pretty much a spot-on description of writing computer software, too, by the way.)

Fermat's Last Theorem is only peripherally about Fermat's Last Theorem. The mathematics in this book stops, more or less, at the level that a strong high school student would encounter. Mostly, it is a sort of history-of-science book, about what the process of "doing mathematics" was like in the second half of the twentieth century.

Which is still a pretty interesting thing to read about.

And, really, the world needs more books about mathematics, of any sort, even if they are just books about mathematicians, rather than books about mathematics. It drives me absolutely crazy when I wander into a magazine rack in a store and I pick up a book full of Sudoku puzzles, and, emblazoned on the cover, it says "No mathematics skills needed!" as if that was something to be happy for. (And anyway they are so wrong: logic and deduction are absolutely mathematics skills. Oh well, what can you do?)

But as it turns out, I already knew most of the story of Fermat's Last Theorem, though perhaps I didn't know quite so much about the individual mathematicians at the heart of the story.

The most interesting part of the book for me, because it was a bit of history that I had somehow never learned, was the discussion of two Japanese mathematicians, Yutaka Taniyama, and Goro Shimura, who together formulated something called the Taniyama-Shimura conjecture when they were both just in their mid-20's; the details of the conjecture turned out to be the critical turning point in "cracking" Fermat's Last Theorem.

If none of this is any interest to you, or if you're not a history of mathematics sort, give Fermat's Last Theorem a pass. But if you think you might find it interesting, it's a fun little book, and perfect for a 6 hour cross-country plane flight!

Thursday, July 11, 2019

Variations in the behavior of the default Java maximum heap size

Since the last millennium, Java implementations have always had system-specific behavior for things such as the maximum amount of memory your Java program can use, also known as the "maximum java heap".

Many (most?) JVM implementations support the -Xmx flag, which allows you to specify the maximum heap size.

But if you don't set that flag, what maximum heap size do you get?

Implementations vary widely in this case.

The most commonly-used JVM implementation is the Oracle JDK, whose behavior is documented here: https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html

In particular, see "Table 2-6 Default Maximum Heap Sizes", which shows that the actual value will

  • depend on your operating system platform,
  • on the choice of a 32-bit or 64-bit JVM,
  • and also on the amount of RAM on the machine,
  • BUT will never exceed 2GB.

However, the OpenJDK, (https://openjdk.java.net/faq/) behaves differently.

With some experimentation, you will find that the Default Maximum Heap Size on an OpenJDK JVM also depends on various variables, but is NOT hard-limited to 2GB, and instead appears to simply use 25% of the RAM on your machine!

I discovered this when I was trying to figure out why we were experiencing extreme memory pressure on a fleet of machines that I manage. It turns out that our administrators had moved us from OracleJDK to OpenJDK on those machines, and our workloads had a bunch of places where we were NOT specifying -Xmx.

For those workloads, each time we spawned a JVM without specifying the maximum heap size, it had (quietly) changed from using up to 2GB of memory, to using up to 25 % of the system memory, and since we routinely spawned 2 such JVMs, half of our system memory was devoted to those 2 JVMs! Since these were quite large machines, having typically 48GB to 64GB of memory, this meant that a very large memory usage change had occurred: instead of 2 JVMs consuming 4GB of RAM total, the 2 JVMs were now consuming 24-32GB of RAM total!

Big machine or small machine, 25% is a lot! Since our machines routinely run thousands of processes, it took me far too long to notice these two processes quietly occupying half the system ram.

So the overall impact was subtle and it took me a LONG time to notice it (many months, sadly), because all that really happened right away was that the workloads ran more slowly, and the machine performance seemed quite poor, and it took me far too long to understand that the reason was that 2 of the 1000+ processes on the machine were suddenly taking half of the memory on the machine.

Unfortunately, this particular behavior does not seem to be documented anywhere (at least, I haven't found the "openjdk documentation for the -Xmx flag"), although since it is open source you can always "use the source, Luke": https://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/runtime/arguments.cpp#l1655

I estimate that I lost, over all of 2019 so far, about 1.5 weeks of my life to this particular detail.

But, happily, I finally figured it out!

Monday, July 1, 2019

Up, up and away

SF’s Brand New Gondola Opens July 1st

One of the most fun ways to get to the Salesforce Rooftop Park isn’t via a boring old escalator or elevator, but by a brand new downtown gondola system with a 20-passenger glass cabin which will connect the Mission Square (the new plaza of the Salesforce Tower at Mission and Fremont) to the rooftop park.

Also,

Salesforce Park’s grand reopening will be a subdued affair

San Francisco’s new transit structure, which shuttered six weeks after opening following the discovery of two cracked steel beams in September, will reopen to the public July 1. And while bus service won’t recommence until mid- to late-July, the park level, arguably the public’s preferred portion of the $2.2-billion behemoth, will once again be accessible.

But unlike the first opening, the gondola, which whisks people up two stories from the corner of Mission and Fremont, will be in operation.

Saturday, June 29, 2019

Yes, I just keep looking at this picture

It's pretty much the perfect picture.

Few things are as abstract and complex as finance

In America, retirement support is roughly divided into two parts:

  • Pretty much everybody has access to the Social Security system, which provides basic support when you get old or if you become disabled and cannot work. Related to Social Security is Medicare, with similar goals and restrictions.
  • A substantial, but not complete, section of the population also has access to individual retirement accounts, which are intended to provide the bulk of your retirement support.

Put more briefly, retirement support is pretty much up to you.

Your primary tool for providing for your own retirement is, usually, your company's 401K plan, which gives you tax-advantaged access to investments, and can be as good or bad as your company wants it to be.

Some companies have very good 401K plans (I'm lucky enough to work at one such company), while others have pretty bad ones, frankly. Your only choices in this area are to try to encourage your company to have the best plan it can, and to consider your company's plan as part of your considerations when you choose where to work.

But then, once you have access to a company-provided 401K plan, you still have lots of work to do, as modern 401K plans are fiendishly complicated.

And they, periodically, send you notices like this:

The new investment options are collective investment trusts (CITs) or “commingled pools.” The commingled pools will offer you similar investment strategy and risk as the mutual funds they replaced, but the expenses will be lower.

Like mutual funds, a CIT combines the money of many investors who own a share of the pool and/or trust. A fund manager invests assets on behalf of all shareholders in accordance with the pool’s stated investment objectives.

Unlike a mutual fund, a CIT is available to investors only through their workplace savings plans. Because they are not publicly traded, some information (e.g., ticker symbols, CUSIP numbers, and Morningstar ratings) is not available. A CIT is not registered with the Securities and Exchange Commission (SEC). It is generally governed by state banking laws and by federal agencies, such as the Internal Revenue Service and the Department of Labor.

Sheesh.

Maybe you go somewhere else to learn about CITs, and you find a little bit more information:

CITs were first introduced in 1927. Early versions of CITs required investor purchases and withdrawals to be processed manually and were valued infrequently, typically only once per calendar quarter, providing investors little access to portfolio and performance data. For this reason, the early adopters of CITs were defined benefit plans.

But starting in 2000, CITs began operating in ways that many believed were more comparable to mutual funds, providing daily valuation and standardized transaction processing, which greatly increased adoption by defined contribution plans. Then, in 2006, the Pension Protection Act provided for a new default investment election for unallocated 401(k) participant assets. These Qualified Default Investment Alternatives (QDIAs) include certain types of “approved” investment strategies and may take the form of managed accounts, target risk funds and target date funds. Many target date funds—the most widely adopted QDIA—are implemented as CITs, and as their assets have grown, so have the assets of CITs generally. Recently, CIT coverage by database vendors such as Morningstar has increased as well, providing additional transparency and reporting capabilities.

CITs have become a popular alternative to mutual funds within qualified retirement plans. Since 2012, CIT use has grown by 56% within DC plans, while the usage of mutual funds has decreased1—a trend that we expect to continue.

Basically, the fact that my company's plan now offers me new investment options which have lower expenses is a Good Thing, but every time I try to learn enough about finance to understand what the heck all these notices and documents are trying to tell me, I feel overwhelmed by the abstraction and complexity of it all.

And, as a mathematician and software engineer, I'm actually pretty good with abstraction and complexity, I think.

Oh, well, on we go.

Tuesday, June 25, 2019

How to spend your June vacation

You're going to be tired after your very long airplane journey.

So you should have some Hand-rolled ice cream.

Or maybe have a cool drink on the patio at Les Crepes

Or even make a day trip to Charlottesville to take in the mountain air

Then, once everything is all set up

And you've had your rehearsal

Then it'll be time to put on your fancy clothes

(Looking good!)

And attend the real ceremony

(Even if your granddaughter finds part of it a little boring)

The end of the ceremony will involve handfasting!

And everyone will be cheering!

And then it's time for the party!

Which means spending time with family

Family, new and old

Three generations!

And spending time with friends

And other traditions, such as the father-daughter dance

And the second line parasol procession

Oh, a wonderful vacation indeed

Tuesday, June 11, 2019

Google have lost my old pictures, I think

It appears that, whatever Google did recently, they have discarded my old pictures that I posted on my blog.

Whatever I did to put my pictures on my blog, they went to something like:

https://lh6.googleusercontent.com/-iqY0yw3vYj8/UgRf2jYNj8I/AAAAAAAACH0/ijmLIzswgNU/w426-h320/IMG_1253.JPG

But those images just fail now.

Sigh.

Live by the cloud, die by the cloud.