Wolfram|Alpha: Systematic knowledge, immediately computable.

Saturday, May 1, 2010

Black Holes Stephen Hawking Knows Not. But You Will.

Black Holes. Undoubtedly the most enigmatic titans of our universe. Prodigious consumers of all matter that finds itself too near their inescapable gravitational grasp, a force so powerful even light itself cannot escape, never to be able to return to the known universe. By Einstein's Theory of Relativity, they are time machines through gravitational time dilation. Perhaps more exotic time travel is possible for those of the species fitting the Kerr solutions to the field equations, allowing travel through time and space, even to other universes.

Through the work of the brilliant physicist Stephen Hawking, master of all things "black hole", we know that we may even be surrounded my tiny, microscopic primordial black holes, and should the geometry of the universe be appropriate, we may find ourselves producing our own microscopic black holes at the rate of one a second through experiments at the Large Hadron Collider. Fortunately, these will evaporate nearly instantly. Recent work by astrophysicists points to the tiny primordial black holes as a likely culprit for the ultra-high energy cosmic rays occasionally observed on earth.

But there are back holes lurking here on earth already. You may be closer to one than you might imagine. They will gobble up your network packets as efficiently as their cosmic cousins quaff matter. I am of course referring to Black Hole Routers and their cohorts in the crime of packet theft, overly restrictive or misbehaving firewalls. What is a black hole router, and why should it matter to a gamer? After some preparatory material, we'll cover that in this blog entry.

In the typical network environment, IP provides the basic Internet layer mechanism on top of the nearly universal Ethernet V2 frame. The commonly used TCP and UDP protocols ride on top of the IP layer. Each Ethernet frame can have a data packet up to 1500 Bytes in size (we'll not go into exceptions for our examples here). The primary purpose of network devices is to route these protocols from senders to receivers, and back. Along any given path between a sender and receiver, there may be devices that are unable to process packets beyond a certain size limit. Usually, the device sending packets to such a device will simply break the packet into smaller packets, a process called fragmentation.

Fragmentation of packets has undesirable side effects, including a performance impact, so ideally we want to minimize this for a route. The same holds true for packets traveling the return path (which may differ from the send path) to the sender. A mechanism that will allow the sender to determine the ideal maximum packet size to avoid any fragmentation will maximize performance and minimize network overhead. The standard mechanism for achieving this goal is known as Path Maximum Transmission Unit Discovery, or PMTUD.

Devices along the path (usually exclusively routers) that must impose a limit on the packet size by fragmentation when the sender has explicitly disallowed fragmentation by using the IP "Do not fragment" (DF, the normal default behavior in modern systems) flag are expected to notify the sender of this limit. This is done thorough a standardized ICMP "Fragmentation needed and DF set" message, with the required limit encapsulated. A sender receiving such a message can adjust the outgoing packet size accordingly. All would be well if everything worked as it should, but in the real world there are routers that misbehave and do not respond with the needed ICMP message, and firewalls that block these needed messages. These are known as Black Holes.

The result is senders appearing to establish a proper connection (the three-way TCP handshake is successful), but having sporadic problems sending and/or receiving data. For a game, this can result in the appearance of lagging, connection loss, etc. (N.B., the PMTUD is normally reserved for the TCP protocol. While it can be used for UDP, it is seldom utilized due to difficulties in determining proper sender behavior for packets dropped by black holes.) Since most games use a combination of UDP and TCP, it is quite possible that black hole on the path between the game client and server(s) will adversely affect game play and connectivity.

Fortunately, there are steps the gamer can take to diagnose and remedy problems with black holes. The Ping utility provides a ready tool to aid us in our diagnosis. Using ping -f -l#, where # is the packet size, we can send probes toward the desired destination. The "f" flag denotes setting the "DF" flag in the IP header.

For example, the command:

ping -f -l 1450 74.125.19.103

will send packets of length 1450 to the destination IP of 74.125.19.103. The returned results will tell us much about the characteristics and behavior of devices along the path of the packets.

If the ping command returns with the expected results, we know that all is well, and no device in the path is requiring a smaller packet size than the length specified (with the addition of the IP overhead).

If the ping command returns with the ICMP "Fragmentation needed and DF set" message, we know that some device in the path needs a smaller packet size to avoid it fragmenting our packets. We can modulate the value of l until we find a length that passes the path with normal results.

If the ping command returns "Request timed out", we know that some device in the path requires a smaller packet size, but is not returning the needed ICMP message or that message is being blocked. As with the second case, we can modulate the value of l until we get the expected return results.

A good starting point for l to work down from is 1472, and 1464 for PPPoE connections. In particular, users of PPPoE should check their environment for proper MTU and PMTUD behavior: in some cases, when PPPoE is done on the router, the PC or responding server may only see the router MTU of 1500, causing dropped packets and connection issues. Check with your ISP to determine if your required MTU is other than the typical 1492 for PPPoe.

Once armed with the appropriate MTU value (l+28, 28 is the overhead for the IP and ICMP headers), we can configure our PC and router as required. Other more drastic measures may be used to diagnose or bypass black holes, such as enabling PMTU black hole detection, disabling PMTUD, and hard setting the MTU (MSS clamping) for the interface device. The details of these steps vary by device and OS, by router make/model, and are beyond the scope of a blog entry.

Consult the documentation for your hardware and OS environment for details, or use the web: there are many excellent detailed descriptions for configuring these settings. Or give Stephen Hawking a call. But you now probably know more than he does on the subject!

Boo! I have you now, child of Satan!

I haven't laughed so hard in a while. This guy might have a heart attack if he played the original S.T.A.L.K.E.R. in the dark...

Caution: Not safe for work / kids content!

Maximum PC: Maximum Content.

I get asked often 'what PC magazine should I get?'. Honestly, there are only three real players as far as I'm concerned: MAXIMUMPC, CPU and Dr. Dobb's, the latter now only available on-line.

There used to be a myriad of well put together PC centric magazines. Sadly, it seems the market for these is not sufficient to support the print publishing side for most of them. Only the strong have survived. Of the few remaining, most have devolved into Reader's Digest style shadows of their former selves, catering to a pretty dumbed-down demographic.

If you're a developer, Dr. Dobb's still has a constant stream of fairly deep and interesting articles that any coder can enjoy. For those that aren't coders, where Dr. Dobb's might be too deep, that still want a slightly more technical bent from a hardware and software standpoint, CPU fits this need well, along with decently in-depth hardware and software reviews.

If you're on the Linux side of things, your choices widen. Linux Journal provides a Dr. Dobb's feel in a Linux centric rag. Linux Magazine and Linux Format provide the novice with a gentler format (but be prepared to check your bank account before subscribing: the cost of these imported periodicals is wallet numbing!)

My desert island choice is MAXIMUMPC. The technical staff there is almost always on the ball, seldom making any glaring errors. The reviews are quite in-depth, you'll have to find a specialist web site to exceed their detail (has anyone figured out the meanings of the occasional random 'factoids' placed in the specifications of reviews? Enquiring minds want to know!)

Since it's my desert island pick, it has fortunately started covering Linux in the recent past, so I'll not miss out too much on happenings in the alternate OS universe.

The writers have a sense of humor sharp enough that it has on occasion generated controversy and feedback from the more uxorious readers. You've got to love it! Always interesting, sometimes controversial, I've been an avid reader since the days when it was called Boot.

Add to this that the publisher has seen fit to make available PDFs of back issues dating all the way back to 2003 at MAXIMUMPC PDF Archives, and you've got to want to support these guys. Their No BS Podcast series is one of the few I'm interested in listening to. Finally, the magazine supports a very active forum community at MAXIMUMPC Forums.

It is the one PC magazine I wait for like a cat hearing a can opener.

If anyone knows of other worthwhile PC centric magazines, I'm all ears! I miss the days of having a panoply of choices.

Getting Teased by Treyarch: COD7 = Call of Duty: Black Ops

I listened in to the the live webcast by BashandSlash covering the roll-out of the teaser video by Treyarch for the upcoming continuation of the Call of Duty game series. It was a gas to listen in on the commentary from a bunch of the BASH regulars and patricipating in the live IRC chats.

The guest list included:

Guests:
PST*Joker (mycallofduty.com), Rudedog (fpsadmin.com), Josh Peckler (planetcallofduty.com), iBleedv20 (omnilinkit.com), John (EFragTV.com)

Special guest
JD_2020 from Treyarch

You can watch the trailer in HD, and listen to the archive of the webcast at BashandSlash

I Read it in a National Enquirer Survey, it Must Be True!

Is extrapolation from forum 'game problem' posts to indicting a game as a steaming pile 'o poo the same as taking a Cosmo survey at face value?

I think so. Every day, I see Forum Fights where particularly vociferous posters scream bloody murder over their current 'problem' game, lamenting how poorly coded some part of the game is, how anserine the developers are, usually by members that have demonstrated through prior diatribes they likely couldn't tell a line of code from a line of coke.

There are of course, mixed in with the cacophonous whiners, posters with real, genuine problems. It is often stated by some in the forums that the number of complaints over a game proves that the game has problems, and not just for them, but for everybody. These posters will argue to no end that this is so, even when shown contradictory evidence such as the vast majority of players that seem to be enjoying the game without issue. To me, their claims have always been analogous to making the logical leap from seeing everyone in a hospital is ill to the population of the planet is sick.

Can we make any valid statistical inferences from what we see in a forum? I think not. I'm more on the number theory side of things, but I'm comfortable enough with my background in statistics to state that we really can't make any valid inferences on the whole population of players for a game from what we see in forums.

Basic statistics (AP High School level) reveals to the learner some facts that at first seem perhaps implausible, and that would most likely seem implausible to the lay person. That valid inferences for large populations can be made from small samples (e.g., a few hundred persons sampled from a population of say one million that is being studied), and that the larger the population under consideration the smaller the sample size needed (expressed as a percentage of the total population) do seem a bit hard to believe.

But basic statistics shows us this is so. The interested reader not already versed can see Sample Size Calculator for some quick experimentation, and Required sample sizes for hypothesis tests in the Wikipedia article Sample Size for a quick brush up on the basics.

Key to these facts is that the sample is unbiased and random. Otherwise, all bets are off. The introduction of of bias can be subtle. Say for example, you are thinking of producing a new widget that improves the flavor of coffee. You're going to take the world by storm! You want to get an idea of how many people would buy it, so you construct a survey, randomly picking a few hundred home phone numbers from the phone book of a random city with a fairly large population. Over a period of a few work days, your staff calls these random possible buyers, and queries their interest. Much to your dismay, very, very few have an interest. Was the survey proper? Can you infer that you might want to rethink your widget idea from the results?

Did you catch the two (and there of course are more) possibly fatal biases introduced by the survey? Firstly, calls were made during 'work days'. Perhaps the most interested prospective buyers work during the day, so you completely missed them in the results. Secondly, just what was the 'random' city? If it turned out to be say Salt Lake City, with a core and suburb population of well over 50% Mormon, a faith that many followers believe precludes the drinking of coffee (actually, from The Book of Mormon: "And again, hot drinks are not for the body or belly."), your results are going to be wildly biased.

So much for an unbiased and random survey.

The posters in a typical game enthusiast forum produce a vastly more biased view of the population than even this woefully inadequate example survey. This is because they are self-selecting. They are there by choice, not because they were randomly selected from the population. Importantly, a high percentage of these self-selected forum members only make posts when looking for solutions to problems, game caused or otherwise, or to state some other dissatisfaction with the product. Self-selection introduces one type of Selection Bias that makes any kind of valid statistical inference nearly impossible, even after adjusting or weighting the data.

One of the more interesting studies related to this kind of problem is covered in the landmark study Comparing the Accuracy of RDD Telephone Surveys and Internet Surveys Conducted with Probability and Non-Probability Samples by David S. Yeager and Jon A. Krosnick of Stanford University. In it, the authors state:

"If the factors that determine a population member’s presence or absence in the sample are all uncorrelated with variables of interest in a study, then the observed distributions of those variables should be identical to the distributions in the population. And if the factors that determine a population member’s presence or absence in the sample are all uncorrelated with the magnitudes of associations between pairs of variables measured in the study, then the observed associations should also be identical to those in the population. However, if these conditions do not hold, then survey results may not be comparable to those that would be obtained from probability samples...More generally, the present investigation suggests that the foundations of statistical sampling theory are sustained by actual data in practice. Probability samples, even ones without especially high response rates, yield quite accurate results. In contrast, non-probability samples are not as accurate, and are sometimes strikingly inaccurate."

Quite the mouthful! Nonetheless, it cuts to the quick of the problem of trying to project the experiences of forum posters with game problems onto the general population of players of the game.

You can't, really. And doing so in a forum rant probably does nothing more than make one look like an Internet Jackass.