“I got you a gift,” said Bunny.
“Yes. It contains a large magnet, a sealed container filled with liquid, and solar cells.”
“Hmmm … ”
“It's also something you collect.”
So I'm trying to think of something that I collect that has magnets, sealed containers with liquid and some electronics. “It's not a Lego Mindstorm kit, is it?”
“Can I see the box?”
“Sure,” said Bunny. She then handed over a six inch cube box to me. It was quite heavy for its size. Blue colored, with “Mova” written on the side.
“I still can't tell what it is.”
She opens the box, and pulled out a clear disk about 2½ inches across and about an inch thick. There were three holes on one side. She also pulled out a few clear rods, also about 2½ inches long and ¼ inch across. They fit into the hole to form what looked like a stand. “Interesting,” I said.
She then pulled out a plastic bag, about five inches across. “Here you go,” she said, handing the bag over to me.
I take it, and pull out a beautiful globe.
The globe itself is encased in a clear shell filled with a special liquid that allows the globe inside to spin. The solar cells are used to drive the globe to spin within the clear shell, by using ambient light as a power source; the magnet inside helps to drive the motion.
It's a wonderful globe, and a wonderful gift that Bunny gave me.
In addition to the Mova Globe, Bunny also thought I would enjoy this globe:
A three dimensional 540 piece jigsaw puzzle of the Earth—an actual nine inch globe. Of course, that's the finished piece. This is what I was faced with when I started:
It certainly didn't hurt that each piece was numbered on the back.
It was quite fun, and it felt a bit like making the Death Star, in an odd way.
Part of my job at The Corporation is load testing. And generally, when I do load testing, I pretty much write code that sends requests as quickly as possible to the server (and I might run multiple programs that spam the server with requests). But recently, Smirk brought to my attention Poisson distributions, claiming that it presents a more realistic load.
I was skeptical. I really didn't see how randomly sending requests using a Poisson distribution would behave any differently than a (large) constant load, but Smirk insisted.
So I wrote a simple UDP service and ran that on one machine. I then coded up two client programs. They were actually identical except for one line of code—the “constant” client:
and the “Poisson distribution” client:
sleep(-log(1.0 - random()) / 5000.0)
sleep(0) doesn't actually sleep, but does cause the calling
process to be rescheduled. This limits the process to about 10,000 messages
a second, so it's a good baseline, and we can always run more processes.
random() returns a value between 0 and 1 (includes 0, excludes
1) and we subtract that from 1.0 to prevent taking the log of 0 (which is
undefined). Logarithms of numbers less than 1 are negative, so we negate to
get a positive value, and divide by 5,000, which means we average 5,000
messages per second. Yes, it's half the rate of the constant client, but
there are two reasons for this—one, we can always run more, and two,
there's a limit to short we can sleep—a value of 0 just reschedules the
process; under Solaris, you can't sleep less than 1/100 of a second (so
values less than .01 are rounded up to .01); Linux is around 1/500 or 1/1000
of a second (depending upon configuration) so 5,000 is kind of a “eh, it's
good enough” value)
(I should also mention that the version of
sleep() I'm using
can take a fractional number of seconds, like
since all the code I'm talking about is in Lua, because I was writing a
“proof-of-concept” server, not a “high performance” server)
So, I run 64 “constant” clients and get:
|packets sent||packets received||packets dropped|
Pretty much around 10,000 messages per second with no dropped data. And now, for 128 ”Poisson distribution” clients:
|packets send||packets received||packets dropped|
Um … what?
Half the number of packets, and I'm loosing some as well? What weirdness is this? No matter how many times I run the tests, or for how long, I get similar results. The “Poisson distribution” client gets horrible results.
And as Smirk said, that's exactly the point.
And the odd thing is, I can't explain this behavior. I can't comprehend what could be happening that could be causing this behavior, over one line change.