July 3, 2009

Anatomy of a slashdotting

Filed under: Uncategorized — marwatk @ 4:43 pm

Well, it’s been a little under two weeks since I made the front page of slashdot. What did the traffic look like? Well, here’s the week before:

Visits pre-slashdot

Visits pre-slashdot

Around 300 hits per day on average. Here’s the slashdotting:

Visits post-slashdot

Visits post-slashdot

10,000 hits the half day it hit, and about 18,000 the day after. About 60 times my normal traffic. But, what did people visit?

Slashdotting Content

Slashdotting Content

The vast majority just read the story, as I expected. But, traffic on other pages was up as much as 200%. The OTA traffic, though, where people would actually download PodTrapper only saw a 32% increase, even with all that traffic. The new trial users looked like this:

Slashdot Impact on Trial User Count

Slashdot Impact on Trial User Count

So while slashdot drove a lot of traffic, it had near zero immediate impact on trial user counts.  Interesting.

I haven’t had a chance to do any thorough analysis, mostly because I’m not sure what kind of analysis would have value. If there are any numbers you’d like to see let me know in the forums.

June 24, 2009

Networking Helper Class

Filed under: Uncategorized — marwatk @ 9:20 pm

Enough users asked for help with networking after reading PodTrapper’s story that I decided to put something together to help with it.

This is the result. (This is the content of the class level javadoc, see the source for more information).

HttpConnectionFactory.java

This class aims to simply HTTP requests on the BlackBerry platform. Use of this class will require signing your application using RIM supplied signing keys.

The BlackBerry platform provides a multitude of different transports for network access. These include WiFi, BES, BIS, WAP2 and Direct TCP.

Not all transports are available on all devices, carriers or service plans. Ordinarily an application must determine on its own which transports are available for a given device, and attempt to connect via them in order. Sample use:

 HttpConnectionFactory factory = new HttpConnectionFactory(
    "http://www.versatilemonkey.com/test.txt",
    HttpConnectionFactory.TRANSPORT_WIFI | HttpConnectionFactory.TRANSPORT_BES );
 while( true ) {
    try {
       HttpConnection connection = factory.getNextConnection();
       try {
          connection.setRequestMethod( "POST" );
          connection.setRequestProperty(
                 "Content-type",
                 "application/x-www-form-urlencoded" );
          OutputStream os = connection.openOutputStream( );
          os.write( "foo=bar&var2=val2".getBytes() );
          os.close();
          InputStream is = connection.openInputStream();
          //do something with the input stream
          if( whatever we did worked ) {
             break;
          }
       }
       catch( IOException ) {
          //Log the error or store it for displaying to
          //the end user if no transports succeed
       }
    }
    catch( NoMoreTransportsException e ) {
       //There are no more transports to attempt
       Dialog.alert( "Unable to perform request" ); //Note you should never
                              //attempt network activity on the event thread
       break;
    }
 }
 

It is possible that an HttpConnection returned by getNextConnection will fail in a method undetectable before attemping the request.

Notes about the various transports from my experience:

Wifi:

Wifi is the least cost to the user and is also the fasted by orders of magnitude

BES/BIS:

- These are largely the same, except BES goes through the user’s corporate network and may be subject to corporate firewalls

- BES/BIS are generally offered as unlimited use to anyone with a BlackBerry specific data plan

- There is usually a limit imposed on the size of files that can be retrieved (usually 5mb, but can be as low as 100kb)

Direct TCP and WAP2:

- These transports use carrier data plans which are sometimes billed at the same rate as BES/BIS, but sometimes are billed separately. It is possible for users to be on unlimited data plans via BES/BIS but be charged per MB for TCP and WAP2. I have never seen the reverse, however.

- Some carriers do not have limits on the file size, others will timeout if you request a file over their limit (instead of a 413 error or similar)

- Some carriers have intermediary proxies that will alter the content of returned files (wrapping them in carrier specific content, for example)

Good luck, I hope this makes networking on BlackBerry easier for you.

Download the source

Powered by WordPress