Bloggin in the UK RSS 2.0
 Saturday, July 17, 2010
I'm digging into SNMP (Simple Network Management Protocol) to see what it offers in terms of application / server monitoring.

The specific scenario I have in mind is the monitoring of queues in MSMQ for our NServiceBus windows services. We need email alerts to be triggered if a message is moved to the error queue or if the number of items in a queue exceeds a certain threshold.

I'm working on a Windows 7 x64 laptop so the first thing I had to do was install the SNMP service (Under CP > Programs and Features).

After that was installed I had to restart the services applet and right click > Properties > Security on the SNMP Service and create a "public" community.



After this I had to download a command line tool Net-SNMP for issuing SNMP queries to test all was well.
I opted for the basic installation and uncheck all the other options.
Open a new command prompt so that it picks up the PATH variable added during installation then run the following command

snmptranslate -IR -Td IF-MIB::linkDown

See the README.txt for the correct response but if you see no errors you are in good shape.

Next download SnmpTools Follow the instructions. I opted to install the 32bit version using the regagentWow6432.reg
Restart the Microsoft SNMP Service then run the command:
snmpget -v1 -c public localhost 1.3.6.1.4.1.15
If all is well you should see:
SNMPv2-SMI::enterprises.15 = STRING: "snmptools by erwan.l@free.fr"

That's all for now but I will update this post again.

As Promised Part 2

I have made a little more progress accessing the MSMQ Performance counters

I have added the following two lines to the Counters.ini file and restarted the SNMP Service:

[1.3.6.1.4.1.15.5]

counter=MSMQ Queue\Messages in Queue\acerbotic\private$\distributordatabus


Now when I issue the following snmpget query from the command line:

snmpget -v1 -c public localhost 1.3.6.1.4.1.15.5

I see the response:

SNMPv2-SMI::enterprises.15.5 = INTEGER: 2

Thus indicating there are two messages in the private$\distributordatabus queue on my laptop.

The End Game

At time of writing it seems that in order to allow our SNMP monitoring software to access this OID I need to supply it with a MIB file.

The story continues...

I have found this page that talks about using a MIB editor to create such a file.


Conclusion

SNMP is a great way to monitor your application, but it involves a good deal of upfront investment if you don't already have a developer on your team who is proficient. We don't have such a developer so have decided to use the .Net framework to expose peformance counters and use WMI to monitor those counters. If the thresholds we set are exceeded we will get alerts.
Saturday, July 17, 2010 1:22:31 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -

Yesterday I attended my first UK SQL Server User Group meeting.
Event web page

Topics

- SQL Server I/O - Tony Rogerson
- Understanding how Sql performs Joins with NestedLoops, Merge & Hash - Ami Levin
- DbSophic QURE - Workload Tuning - Ami Levin
- SQL Streaminsight - Allan Mitchell - twitter: @allanSQLIS

I was most interested in the first topic but missed the talk as I did not arrive till 18:30 and the evening started @ 17:30. I don't finish work till 18:00 and had to get across town. Of the three talks that I caught the content and delivery was at a very high standard.

Understanding how Sql Server performs Joins with NestedLoops, Merge & Hash - Ami Levin

If you write a lot of SQL queries or are often called upon to tune SQL Server then you should learn how/why the query optimizer selects from three physical operators to perform joins and how sometime it can be caught out. This talk was given by Ami Levin who is a SQL MVP and works for DBSophic. It was really interesting and the first time I have had any understanding of what these terms that appear in the execution plan mean. One really interesting thing that Ami pointed out is that sometimes the method Sql uses to estimate the number of rows and actual number of rows will differ by a large amount, this can result in a sub optimal operator being selected to perform the join. If when tuning you spot this sort of discrepancy further investigation is warranted. The following is a scenario that Ami gave when this can occur:

SELECT *
FROM SalesLT.SalesOrderHeader SOH
INNER JOIN SalesLT.SalesOrderDetail SOD ON SOH.SalesOrderID = SOD.SalesOrderID
INNER JOIN SalesLT.Product P ON P.ProductID = SOD.ProductID
WHERE SOH.TotalDue > 1500
AND SOD.UnitPrice > 300
AND P.StandardCost > 300

So in the SQL above the optimizer will use statistics to estimate roughly how many rows it will return by looking at each table in turn and estimating how many rows each where clause will return. In this case say that each Where clause will return ~1% of the rows in a table containing 100k rows so the optimizer estimates the number of rows to be 1% of 100,000 = 1000 rows then, 1% of 1000 = 10, then 1% of 10 < 1. So the optimizer thinks 1 row or less will be in the results set. Unfortunately what the optimizer cannot know is that the where clauses are releated to the data, in this case ORDERS that cost more and have more expensive unit cost and a higher so the actual number of rows returned will be nearer to 1000, hence why sometimes the optimizer can choose a sub optimal physical operator to perform a join.

If you think the wrong operator is being chosen you can use the OPTION keyword this article discusses in more detail:

Saturday, July 17, 2010 12:01:54 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -

 Friday, May 21, 2010
To Produce this: 
================
<ProductModelData ProductModelID="7" ProductModelName="..."
ProductIDs="product id list in the product model" >
<ProductName>...</ProductName>
<ProductName>...</ProductName>
...
</ProductModelData>

You need this:
==============

SELECT ProductModelID as "@ProductModelID",
Name as "@ProductModelName",
(SELECT ProductID as "data()"
FROM SalesLT.Product
WHERE SalesLT.Product.ProductModelID =
SalesLT.ProductModel.ProductModelID
FOR XML PATH ('')) as "@ProductIDs",
(SELECT Name as "ProductName"
FROM SalesLT.Product
WHERE SalesLT.Product.ProductModelID =
SalesLT.ProductModel.ProductModelID
FOR XML PATH (''), TYPE) as "ProductNames"
FROM SalesLT.ProductModel
WHERE ProductModelID= 7 or ProductModelID=9
FOR XML PATH('ProductModelData')

The key is the ", TYPE" after the "FOR XML PATH(''), the example on MSDN is missing this key component.

Friday, May 21, 2010 6:08:13 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -

 Wednesday, May 05, 2010
First let me say I love Spotify and use it everyday at work, because I love it I feel compelled to discuss the company's failure to captialize on their initial brilliant idea to use P2P networks as a way for people to choose the music they want to listen with either the advert subsidised or premium service.

What they got right was the business model and the user interface design. The software is easy to use, the obvious feature that is missing is improved playlist management. What I cannot get my head around is how long it has taken for new functionality to be added to the client to illustrate my point I trawled the Spotify blog for the details of releases during 2008 the list is below. Bear in mind development started in September 06' and the first beta was released in May 07' so by 2008 the software should have been pretty stable.

New features added in 2008 for Windows Client

  • User settings can be changed.
  • We mark all collaborative playlist (including your own) with a padlock icon.
  • Context menus have been added for the artist title on artist and album pages. (0.2.12)
  • a new start page with top lists has been added (0.2.12)
  • Spotify now pauses when waking up from hibernation (0.2.13)
  • A new view has been added to visualize the play queue. (0.2.14)
  • Growl support has been added. (0.2.14)
  • Dropping a link to a playlist, artist or an album on the play queue will cause Spotify to play future tracks from that source. (0.2.15)
  • History now shows the currently playing track as well. (0.2.15)
  • New streaming protocol (0.3.0)
  • Proxy Server Support (0.3.3)
  • Improved Buffering Algorithm (0.3.3)
  • Undo for playlist operations has been added (0.3.8)
So in the course of a year there are no notable features added, there was a ton of bug fixes and load of work done to polish the UI. The big question is why, were the team too busy firefighting or doing lots of work to the infrastrcuture or were they hampered by their choice of language and tooling whatever the reason it is shocking.

Spotify's main failures

  • Not Entered the US Market / gone global
  • Not solved the scalability issues
  • Still missing some important labels / artists (ACDC / Oasis / Beatles etc.)
  • Not delivered any meaningful features to the Windows client for 3 years (with the exception of collaborative playlists)
As things stand they have left a clear path for competitors to come into the marktet and take the lions share. The barriers to entry are deals with the record lables and the p2p technology.
If you want to send feedback to spotify email feedback@spotify.com

Wednesday, May 05, 2010 10:03:22 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Spotify
 Tuesday, April 20, 2010

Official NserviceBus Documentation

The NServiceBus Host
Profiles for the Generic Host

Our Deployment Details

Version: NServiceBus v2.0 RTM
OS: Windows 2003 Server
App Type: Windows Service
Host: NServiceBus.Host.exe
Subscription Storage: MSMQ

Our Goal

We have just created a new publisher service and it has taken a bit of time to understand exactly how to deploy it so that subscriptions were persisted after the service is restarted.

Out of the box NServiceBus has three options for storing subscription data, Memory, MSMQ or Database.

To use MSMQ you must either create your own custom profile that configures subscriptions to be stored in MSMQ or you must select Integration from  the default profiles.

Regardless of the choice you make you must specify the profile you wish to use when you install the windows service, here is how you do that:

Basic Integration Example:
NServiceBus.Host.exe /install NServiceBus.Integration

Advanced Production Example:
NServiceBus.Host.exe /install NServiceBus.Production /serviceName:MyService /displayName:MyDisplayName/description:MyDescription /username:DOMAIN\username /password:MyPassword

To check the service has been setup correctly you can go and look in the properties of the service and check the text at the end of the "Path to executable" field. The example in the screenshot below shows the service is configured to use the Lite profile.




We had one more gotcha our implementation was copy/pasted from one of 
our existing v1.9 services so we had to remove the .MsmqSubscriptionStorage()
option from our config. Now our endpoint config looks like this

public void Init()

{
            NServiceBus.Configure.With()
                        .DefaultBuilder()
                        .XmlSerializer()
                        .MsmqTransport()
                        .IsTransactional(true)
                        .PurgeOnStartup(false)
                        .UnicastBus()
                        .ImpersonateSender(false)
                        .CreateBus()
                        .Start();
}


The Default Profile's Subscription Storage



Note: - If you select Production profile you may need to enable some settings inside MSDTC (in Component Services) if your database is on another server.
         - If you are installing on to a machine that has UAC enabled you must run the install from a cmd prompt with elevated priviledges (Run As Administrator)


Tuesday, April 20, 2010 2:08:25 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
nServiceBus
 Wednesday, April 07, 2010
I am interested in the Microsoft MVC framework so with a view to understanding it properly I decided to pick an open source project that uses it to help me understand what a real implementation looks like. I heard Phil Haack talking on the Herding Code podcast about subtext and it sounded like it is using some interesting technologies, MVC, Lucene & URL routing^.

Installation on Windows 7 for Development

My Development Platform
- Windows 7 64bit
- Visual Studio 2008 Professional
- Sql Server 2008 (10.0.2531) - 64bit Enterprise
- SVN Revision Number: 4007

Here are the steps I had to complete to begin debugging subtext.
1) Check out the source code - follow this link: http://code.google.com/p/subtext/source/checkout
    or if you have an SVN command line client you can try the command below but it may become out of date.
    svn checkout https://subtext.googlecode.com/svn/trunk/ subtext-read-only
   
    TIP: When I attempted to checkout the code on my laptop with a 3g dongle I kept getting the error:
         svn: Server sent unexpected return value (400 Bad request) in response to OPTIONS request for 'http://subtext.googlecode.com/svn/trunk'
         Change the URL to HTTPS://... resolved the issue, I think the cause was a silent proxy.
2) Setting up the database.
    If you have Sql Server installed on your dev machine I think that the idea is that the database will install the first time you run the solution.
    On my machine I had to manually attach the database myself.
        - Open up Sql Server Management Studio and select 'Attach Database'.
        - Navigate to the sub folder <SVN Checkout Folder>\src\Subtext.Web\App_Data
        - If a Log file appears with a message not found delete it then hit ok.
        - Then I updated the connection string to "Data Source=LOCALHOST;Initial Catalog=Subtext2.5;Integrated Security=SSPI;", this can be found in the          Subtext.web web.config
       
3) At this point if all is well you should be able to run the soltion and get the "Installation Wizard" page:
    Step 2: Configure the Admin Account (I just followed the instructions and completed the form)
    Step 3: Create A Blog (I just clicked the button)
   


Some useful reading
http://code.google.com/p/subtext/wiki/DeveloperGuide - Some basic info on getting started with development
http://subtextproject.com/Features-and-Requirements.ashx - Details of features and resources.
svn checkout https://subtext.googlecode.com/svn/trunk/ subtext-read-only

Installation on specific Hosting Sites

softsyshosting

Go Daddy


Wednesday, April 07, 2010 7:20:15 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] -

 Monday, March 08, 2010



We have been using nServiceBus in production for over 6 months now, we have had a very positive experience, so I wanted to show how we have been using it with some real world examples. One implementation we have just released handles inbound SMS messages and checks the sender's number to see if they are an existing or new customer then reacts accordingly.




1) Our SMS provider calls our http handler (hosted in IIS) each time an inbound SMS is recieved.
2) The http handler calls the SmsGateway via a WCF service, which in turn publishes an InboundSmsMessage to the bus.
3) The Subscriber receives the InboundSmsMessage it interrogates the database to see if this is an exising customer or not.
4) Finally is sends a command to the worker service depending on whether this is an existing customer or not.
5) If the SMS is not from an existing customer then the worker initiates a call between the number and a CS agent.

Benefits of this approach

If their is a sudden surge in inbound Sms messages due to a successful advertising campaign we can control processing to avoid degrading overall system performance. We could further isolate our message processing from the core system by creating a cache on the Subscriber of all existing customer's mobile numbers. This cache could be kept up to date by the publishing new customer messages.

If other services need to know about inbound SMS message say for invoice reconcilliation or just marketing reports they can subscribe to the messages and aggregate them. This can be done in realtime to allow the marketing team access to a dashboard that provides feedback on the effectiveness of their campaigns.

The most obvious benefit is that the Sms Gateway is autonomous, and the services that subscribe to the inbound messages need no understanding of what an SMS message is or it's semantics.

UPDATE:
We have since realised that our implementation is not optimal, we are going to host NServiceBus in IIS and send and Inbound message notification to the SMS Gateway service and remove the WCF piece.


Monday, March 08, 2010 4:08:52 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
nServiceBus
 Saturday, February 27, 2010

These are listed best first, if the app is only relavent to UK users like myself it will have #UK after


Ebay

The Ebay iphone app is awesome, with only 480x320 pixies Ebay have managed to create a user experience that blows away it's own website. Admitedly the the Ebay website does not set the bar very high. The UI is clean and functional search is easy and it remembers your searchs. Once you have found the item you wish to bid on or buy it takes only 3 clicks to enter your bid and one more to confirm. For me this is the app that all other shopping app's should aspire to.

Tube Map - #UK

A great tool to help you navigate Londons Underground

Ping

Great tool for techies allows you ping, tracerout and telnet.

Twitterific

One of several twitter clients available very handy for catching up on twitter.

Facebook

No explanation necessary

Saturday, February 27, 2010 3:18:39 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -

Archive
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010
Charlie Barker
Sign In
Statistics
Total Posts: 172
This Year: 14
This Month: 1
This Week: 0
Comments: 77
Themes
Pick a theme:
All Content © 2010, Charlie Barker
DasBlog theme 'Business' created by Christoph De Baene (delarou)