How to Choose an Option to Host Public Website in Microsoft Azure

at
Difference Between Azure Virtual Machines and Azure Web and Worker Roles


There are three options for subscribing (Azure virtual machines / IAAS, Microsoft Azure Web Role /PAAS, Microsoft Azure Website / PAAS) Microsoft Azure and all of them can host site. It is essential to be understand the differences among them before deciding the options to adopt.

Azure Virtual Machines are the common instances of full server operating systems hosted on a virtual platform. Just like with any VM, users can remote into it and having the right access rights, can control everything on that machine. Nothing new here, just a good-old virtual machine service offer.

On the other hand, Worker and Web Role compute instances are also in their essence virtual machines, yet with limited access. Web Roles are primarily used for hosting websites and web applications, while Worker Roles – long running or resource intensive processes. With a Web Role, users only have access to the IIS, and with a Worker Role – runtime environment for running processes and services without a public facing website. Essentially the IIS and the runtime environment are the only things you have access to. All changes outside of these environments will be erased upon a system restart, a restart of a virtual machine hosting the role. This means that users have almost no control over the rest of the server configuration, although, it is possible to write startup scripts to make changes upon a reboot.

So in their essence, Web and Worker Roles are hosted by VMs, and when purchasing a role, by selecting the size of the VM in the Cloud section of the Azure calculator, you are selecting the size of the compute instance (VM) hosting the role. This is why Microsoft calls both of these options virtual machines, however, it is important to understand the difference, as it is what distinguishes the IaaS and PaaS services.


Pros and Cons


Recommended Azure Environment for Sitecore
The Pure PaaS approach (versus Hybrid) is the recommended option, primarily because of the SLA and scalability applied to the CM environment, allowing for a high availability and spikes of content edits and visits on large websites. This approach is especially preferred if the rest of the company infrastructure is also hosted on Azure.
Some of the reasons to go with a hybrid solution include:
  • budget considerations
  • large  number of on premise resources
  • tight security requirements
  • need for control over the hardware
  • other business reasons

Azure Compare to Amazon on Webhosting

Netcraft posted an article in Feb 2014 showing that Microsoft is slightly ahead of Amazon in public facing website hosting of Windows computers. The numbers are close with Netcraft listing 23,400 web-facing Windows computers at Microsoft and 22,600 at Amazon.  List of notable users of Windows Azure, including
  • the Sochi 2014 Olympic Games,
  • Aston Martin (sports car manufacturer),
  • McDonald's Happy Studio, and
  • BenQ, a Taiwanese electronics brand.

Pricing


Reference

the Traps on Maintenance Cost

at
Recently a friend of mine complaint that he cannot understand why the maintenance cost for an application remains so high after 2 years of deployment.  After a lengthly conversation, we found out he fells into the same traps of maintenance as i did before.

First, maintenance cost is not just bug fixes.  While my friend is wondering how could the bug fixes would cost be so expensive,  majority of his expenditure went for operation, user support, and enhancements.  These expenditures includes
     1. purchasing new servers to replace old ones
     2. subscribing User Support service to train users and provide first level support
     3. releasing couple major enhancements
In additional to those, there are another two other expenditures he did not noticed. The advanced users has been continuously spending time to train and re-train other users.  And money and time were spent to decommission the old server.

Second, maintenance costs will not necessary decrease over years.  In my friend case, although less bugs were fixed in the second year, but the enhancements and User Support service drove that year's maintenance costs away more than the first year's.  For large volatile applications, the maintenance costs could eventually increase.  As enhancements add complexity to applications, the efforts are required for making changes, testing, and user training will increase.  And likely more infrastructure investment will be needed.

Third, there is no minor enhancements.  As soon as an enhancement is classified as "Minor", the users will expect quicker turnaround, development team will reduce the effort on analysis and code review, QA team will spend less time on testing.  All of these usually lead to a crisis and spending more effort cleaning up some unexpected damaged.  it happened to both my friend and me multiple times, and to make it worse, at the beginning we were usually hunting the cause in wrong direction because at that crisis no one expected or even forgot the minor enhancement could cause the problem.

What does this mean to Program Managers?  This means, in order to minimize the maintenance cost, maintenance should be considered as a decision factor as early as the design stage.  My boss demonstrates an effective and simply way to archive this -- Focus.

Focus on the core business value of the solution and turn away from distracting feature requests.  In this way, the team can be devoted to develop a linear but more effective and more matured solution.  Hence require less effort keep it from running during the life span.

Focus on the sustainability of the solution.  This means make the dependability, integration, ease of upgrade, and duration of technology life expectation must be take into consideration in design

SQL SSRS Report Subscriptions Architect

at

Summary
This letter describes the architecture for the SSRS Report Subscription, including:
1. Its database and tables for storing the subscriptions information, and
2. The approach for triggering and rendering the subscriptions



Details
SSRS has two databases -- primary one named SSRSReports and an other working database named SSRSReortsTemp.  the subscription data is spread among the tables of Subscription, Reports, and Events in the SSRSRreports database.


Tables Schema




Triggering the Subscription Schedule Report
Subscriptions are triggered by scheduled SQL jobs. These jobs can be found along with SQL jobs defined by users in the job section using the SSMS.
Such a job is ceated for each report subscription when the subscription was created.  These jobs are named using the subscriptions' GUID and scheduled according to the subscriptions' schedule. See highlighted samples below.

Once a job is triggered by SQL job agent, it enters a "TimedSubscription" event into the Event table. SQL agent checks the table every 10 seconds to pickup the new event and renders the report.

Script to manually run report subscription

at
Summary
This note describes how to manually run the SSRS report subscription. This can be applied when
- Test if the subscription work when setting up the subscription
- Manually run subscriptions in case of failure.

Details
Running a report subscription is an "Event" in the SSRS server. Therefore, manually running a subscription can be as simple as adding an event into the SSRS database and this can be done via the script below on your SSRS database.

EXEC AddEvent @EventType='TimedSubscription', @EventData='[YourReportSubscriptionID]'

Note: the SSRS database name usually in the format of 'ReportServer' then '$' and then the instance name

To automate the script further for re-runing failed subscriptions, you can fetch the subscriptionID that has a failed last run status (laststatus = 'Thread was being aborted.') from the Subscriptions table, then build the addEvent script onfly. Below is a sample of completed script.

DECLARE @strSQL AS NVARCHAR(MAX)

SET @strSQL = ''

SELECT @strSQL = 'EXEC AddEvent @EventType=''TimedSubscription'', @EventData=''' + CAST(SUBSCRIPTIONID AS NVARCHAR(MAX)) + ''' ' + CHAR(13)+CHAR(10) + 'GO' + + CHAR(13)+CHAR(10) + @strSQL
FROM SUBSCRIPTIONS
WHERE laststatus = 'Thread was being aborted.'

EXEC @strSQL
 


To use the script above, please follow the steps
1. Connect to your SSRS database server via SSMS
2. Connect to the SSRS database (refer to the note above for database name)
3. Click on New Query button on the upper-left screen
4. Copy and paste the script above
5. Click on Execute button to run the script
6. The result should be "1 row effected"
7. It will take about 30 seconds (also depends on how long the report takes to run), then the status should be change on the SSRS subscription screen

The script can also be modified to run the subscription manually for a specific report.  see script below.  NOTE, if the report has more than one subscriptions, all subscriptions will be ran

DECLARE @strSQL AS NVARCHAR(MAX)

SET @strSQL = ''

SELECT @strSQL = 'EXEC AddEvent @EventType=''TimedSubscription'', @EventData=''' + CAST(SUB.SUBSCRIPTIONID AS NVARCHAR(MAX)) + ''' ' + CHAR(13)+CHAR(10) + 'GO' + + CHAR(13)+CHAR(10) + @strSQL

FROM CATALOG RPT

INNER JOIN SUBSCRIPTIONS SUB ON RPT.ITEMID = SUB.REPORT_OID

WHERE NAME = '[YourReportName]'

PRINT @strSQL
 

How to get all triggers text in the DB at once

at
Aim: How to get the text for all delete triggers in the database at once.

Analysis:

For each table, the ID for each of their triggers (INS, UPD, DEL) are stored in DELTRIG, INSTRIG, AND UPDTRIG columns in the sysobjects table.



The text (t-SQL code) of triggers and all other t-SQL code are store in TEXT column in syscomments. To have the text with proper line breaks, change the Query Editor to "Result to Text", and increase the number for the "maxiumn number of character displayed" in the Query Editor's Option dialogOther trigger information are stored in the SYSOBJECTS table also, including NAME, ID, Parent_ID. Both The Parent_ID and DELTRIG value for trigger in the SYSOBJECTS table are refering to the ID of table that own the trigger



Solution:

1. Get all the delete triggers' text from the database

SELECT SC.TEXT
FROM SYSCOMMENTS SC
INNER JOIN (SELECT DELTRIG FROM SYSOBJECTS WHERE XTYPE='U') DT ON SC.ID = DT.DELTRIG


2. Get list of tables and associated triggers in the database

SELECT SO.NAME, ST.NAME,
CASE WHEN ST.ID = SO.DELTRIG THEN 'DEL'
WHEN ST.ID = SO.UPDTRIG THEN 'UPD'
WHEN ST.ID = SO.INSTRIG THEN 'INS' END TRIGGERTYPE
FROM SYSOBJECTS SO
INNER JOIN SYSOBJECTS ST ON SO.ID = ST.parent_obj
WHERE SO.xtype = 'U'