Thursday, August 25, 2016

5 Fixes for Formula 1

The circus that is Formula 1 is more Telenovela than race series anymore.  Almost all the excitement and intrigue exists off the track while the races themselves seem like parades.  Modern tracks with near infinite run-off areas, attempts at cost cutting, ever changing and inconsistently applied rules, a façade of greenwashing, and the FIA's inability to manage the sport contribute to dreadfully dull races.  The troll that runs the show continues be more interested in placating dictators than actually putting on a show.  If F1 is supposed to be the pinnacle of motorsport with the most advanced machines then we'd get back active suspension, ABS, traction control and active aero among other things.  Here are my fantasy changes to the sport to mix things up, make the races less predictable, and generally more exciting.  While I'm sure Bernie Ecclestone would love to be able to charge me for the privilege of comments on Formula 1, I'm going to do the next best thing and give it to him for free.
Typical F1 Parade - Monaco 2015
Typical F1 Parade - Monaco 2015

Fix 1: Qualifying

This one is tough because for the 2016 season changes were attempted that made no sense and honestly wouldn't have affected results and were dropped after a few races.  But for the last two years, going on three, we've had one team so dominate qualifying that even the current format has become dull.

Flip a Coin

In GP2 and other series, qualifying sets the grid for multiple races with one race having a normal grid and the following a reversed grid.  F1 won't get around to having multiple races on the same weekend on the same track, so simply randomly choose at the completion of qualifying whether the cars will grid the race in qualifying order or in reverse.  To keep teams from attempting to get mid-pack positions, award driver's championship points for pole through 5th.

Fantasy Island

Scrap the current format entirely.  On Saturday, put all the drivers in Porsche Cup cars, run a 20 lap sprint race, and finishing positions of this race determine the grid on Sunday.  The grid for the qualifying race can be determined by the reverse placing of the previous race.  You won the last race, you start the qualifying race last, etc.  Qualifying stops being a test of who has the fastest car, but who is the best driver as they all get the same equipment.

Fix 2: Bring Back Testing

The biggest argument against testing has always been cost.  The teams with the most money could effectively run shadow teams and thousands of hours of running to develop the car and drivers throughout the season.  It's certainly how Ferrari was able to maintain dominance in the Schumacher era.

But we need testing.  The smaller teams are still losing out to the big money.  Instead of testing, though, it's computer modeling and simulators that are winning the day.  Additionally, new drivers are being thrown in the thick of things with almost no time behind the wheel of these cars.  This creates a safety issue with drivers like Pastor Maldonado never really coming to grips with their cars and causing many accidents.

So bring back testing, but in a regulated fashion.  Limit the number of hours of testing a team has between each race weekend.  Make that limit inversely proportional to the team's current world championship standing.  Your team is dead last?  You get 20 testing hours between the end of the race until the following Friday practice.  Your teams is first?  You get no testing hours, 2nd in the standings gets 2 hours, 3rd gets 4 hours, 4th gets 6 hours, 5th gets 8 hours, etc, etc, etc.  Use the time before the next race weekend or lose it.

Fix 3: More Engine Development

This one is tough in the current environment.  With so few engine manufacturers participating in F1, it would be difficult to regulate engine development the same way as testing.  But if engine development was available throughout the season the more makes might be interested in being in the sport.  The rules were tweaked after Honda's return and abysmal showing.  They can be tweaked again so we can try and get more parity.

The maths here would be less than straight forward.  Aggregate and average the teams constructor's points and rank the engine makes.  Then allot "tokens" inverse to the rankings.  

Fix 4: End Fuel Restrictions

Hyper-miling a race car should be anathema to the sport.  It makes no sense.  You want to watch a race that's environmentally conscientious, go watch the World Solar Challenge.  Taking a car that makes 8mpg and forcing battery packs and electric motors on it so it makes 9.5mpg is not being environmentally sound nor makes the cars relevant to production models.  It's not even greenwashing.  It's just dumb.

I've accepted that refueling won't come back to F1.  The sport has become too risk averse to allow any potential injury to occur, especially in the pits.  A 1.97second pit stop is an amazing feat and a super coordinated ballet, and maybe 7.5seconds is too long for a pit stop.

If we aren't going to get refueling and have a fixed fuel tank size, then at least remove the fuel consumption rate limits.  Better yet, no refueling, no tank size restrictions, and no consumption rate limits.  If you can go the full race distance on less fuel and win because your engine is more efficient, that's a bonus.  Fuel is weight and weight is enough of a penalty.  During the RedBull run of four consecutive world championships, the Renault engine was well known be down on power by 10-15hp to the Ferrari engines at the time.  But they were more fuel efficient, so Sebastian Vettel could start the race on a lighter fuel loading to pull away from the pack.

Fix 5: Consistent In-Race Reviews and Penalties

Whether it's worse now or has always been bad could be a whole series of articles.  This problem plagues many sports, especially at the professional level.  How do you make sure the rules are applied equally and consistently across the teams, players, games?  The NHL and MLB both instituted a centralized replay review system to even out the uneven officiating along with changes in referee training.

How Charlie Whiting applies the regulations appears to be based completely on whimsy and is otherwise opaque.   As an example, during a race Jenson Button was given a drive-thru penalty for a radio communication violation adding about 23 seconds to his lap time and dropping him several places.  Nico Rosberg finished the race dragging this front wing and spewing carbon fiber debris all over the track for a third of a lap and had 10 seconds added to his race time resulting in no position changes.

The radio violation was so ridiculous, that the radio ban regulation was dropped after that race.  Rosberg not only caused an accident that amazingly only hobbled his car, but then proceeded to make the track more dangerous for other drivers by not stopping his car per the regulations.  How was that not a disqualification?  Only Charlie Whiting knows.

If the FIA wanted to get serious about regulating the sport, then the first thing it needs to do is make sure its designated officials at the track actually know how to apply the rules in an unbiased fashion.  Many have expressed that FIA stands for Ferrari Interference Association, but clearly they have a love of another manufacturer these days.


  • Either randomly reverse the grid before the race or have everyone qualify in the same car.
  • Allot testing hours to teams based on constructor championship standings.
  • Allot engine development tokens based on overall average constructors' points.
  • Stop rate limiting fuel consumption.
  • Apply the sporting regulations consistently and apply penalties quickly.

Tuesday, August 9, 2016

Simple Alert Paging with Slack Push Notifications

Frustration with my home network's WAN connectivity randomly flapping and being somewhat cheap led me to see if I could get paged without having worry about email relays or paying for your traditional notification service à la PagerDuty (pricey) or VictorOps (unreliable).

The first order of business was to write up a simple script to perform some checks against my home network.  It's a simple shell script run through cron that maintains a running log of check attempts and results.  Each time it runs, reads the last result, performs new checks, and if the state changed from the previous attempt, then send out an alert.

The code for the script is below or check it out at GitHub.
#!/bin/bash ## Very basic check to see if home network is up. ## First attempt SSH connection to server. ## If this fails, then attempt to ping router. ## Record result of check to logfile. ## If current check status is different than last check status ## sent message to Slack via webhook ## Host and SSH port to check hName="[HostName]" port="[Port]" ## Slack Hook and Channel slackWebHook="[WebHookLink]" slackChannel="@[SlackUserName]" ## LogFile to maintain check state. logFile="/[someLogDirectory/check-home.log" ## Send a color coded message to Slack function notifySlack () { status=$1 hostname=$2 result=$3 case "${status}" in OK) color="good" ;; WARNING) color="warning" ;; CRITICAL) color="danger" ;; *) color="#909090" ;; esac payload="\"attachments\": [{ \"title\": \"${hostname} status is ${status}\", \"text\": \"${result}\", \"color\": \"${color}\" }]" if [ ! -z "${slackChannel}" ]; then curl -s -XPOST --data-urlencode "payload={ \"channel\": \"${slackChannel}\", ${payload} }" ${slackWebHook} > /dev/null 2>&1 else curl -s -XPOST --data-urlencode "payload={ ${payload} }" ${slackWebHook} > /dev/null 2>&1 fi } ## Get previous status lastEvent=`tail -1 ${logFile}` lastStatus=`echo ${lastEvent} | awk '{ print $4 }'` ### First Check Host if SSH is up. results=`echo QUIT | nc -v -w 5 ${hName} ${port} 2>&1 | grep -v mismatch` res=`echo ${results} | awk '{print $5}'` ## Check connection status, set to WARNING if this fails if [ "${res}" != "open" ]; then echo `date +"%h %d %T"` WARNING $results >> ${logFile} status="WARNING" ## Try pinging host results2=`ping -c 5 ${hName} | grep packets` percent=`echo ${results2} | awk '{ print $6 }' | sed -e 's/\%//'` if [ "${percent}" -gt 0 ]; then echo `date +"%h %d %T"` CRITICAL $results2 >> ${logFile} status="CRITICAL" fi else ## Otherwise we are okay echo `date +"%h %d %T"` OK $results >> ${logFile} status="OK" fi ## Do we notify Slack? if [ "${status}" != "${lastStatus}" ]; then results=`tail -1 ${logFile}` notifySlack "${status}" "${hName}" "${results}" fi
The script is run simply through cron and I have it scheduled to run every 2 minutes from a machine outside my home network.  For myself, I don't have the script post to a channel, but rather it sends a direct message.  Then in my Slack notification settings, I make sure it sends a push notification for direct messages and for certain words/phrases.
 In the above, the system alerted when its SSH check against my home machine failed.  I only consider this a warning as the overall network could still be okay.  The logic flow dictates, that if the SSH fails, then it attempts to ping the router.  The below shows an alert and recovery related to the WAN interface dropping off the Internet.

Overall, it works pretty well.  Using a script and cron is pretty rudimentary monitoring, but it accomplished the basic need.  These alerts have allowed me to narrow down my search through the logs from my home router to track down its problems.  

Saturday, March 26, 2016

Found Item: Retroactive Fortune Cookie

Fortune: You would do well in the field of computer technology.
Well, duh!
I received this fortune in a cookie from lunch the other day.
  Lunch was catered Chinese
    in the office of my current employer;
      an Internet technology start-up
        where I stand in front of computer screens
          For large portions of the day.

I manage a team of computer people.
  More often called System Administrators, or
    Network Administrators, or
      Site Reliability Engineers, or
        Site Reliability Operators, or
          IT, Ops, or DevOps*.

Some of my time involves meetings
  with software developers and engineers
    solving software and service architectural problems
      and coming to agreements on how to progress forward.

Sometimes I even write code
  something I've been doing since 1983.
    Other times I setup, configure, and maintain
      large scale Internet infrastructures and web services.
        The combination of those two functions has been my profession since 1993.

Over 20 years in this field.
  It doesn't really seem that long.
    Probably because I've done well by it
      And for the most part enjoyed the work very much.

I guess this fortune cookie turned out true
  If maybe a bit after the fact had been well settled.
    Had I received it 30 years ago, though,
      I would've just said, "Duh, I'm going to do that anyway."
* I consider DevOps to be an organizational structure and philosophy focused on development and operational practices.  It is not IMHO a job title or position.  Using it as such is frequently a sign that someone doesn't know what they are talking about.

Alcohol content: a wee dram (Macallan Fine Oak 21 Year)