This post continues the series from AWS ALB Price Planning w/ IIS : Rule Evaluations.
In the last post, I looked at the basics of pricing a single site on an ALB server. This time I’m going to dig in a little further into how to group multiple sites onto multiple ALB servers. This would be to allow a transition from a single IIS proxy server to multiple ALB instances.
Background
- The IIS proxy server hosts 73 websites with 233 web applications.
- Any site with 8 or more web applications within it will be given it’s own ALB server. The LCU cost of having over 10 rule evaluations on a single ALB are so dominant that it’s best to cut the number of rules you have to less than 10.
- Of the 73 websites, only 6 sites have 8 or more web applications within them. Leaving 67 other websites containing 103 web applications.
Findings from last time
I looked at grouping by number or rules and by average request counts.
If you have figured out how to get all the import jobs, tables, and stored procedures setup from the last couple posts then you are amazing! I definitely left out a number of scripts for database objects and some of the scripts have morphed throughout the series. But, if you were able to get everything setup, here’s a nice little view t0 help look at the expenses of rule evaluation LCUs.
Just like in the last post, there is a section at the bottom to get a more accurate grouping.
Simple Grouping
To do the simple groupings, I’m first going to generate some site statistics, usp_Regenerate_ProxySiteRequestStats. They really aren’t useful, but they can give you something to work with.
You can combine those stats with the WebAppCounts and use them as input into a PowerShell function. This PowerShell function attempts to:
- Separate Single Host ALBs from Shared Host ALBs
- $singleSiteRuleLimit sets the minimum number of sub-applications a site can have before it is required to be on it’s on ALB
- Group Host names into ALBs when possible
- It creates a number of shared ALBs (“bags”) which it can place sites into.
- It uses a bit of an elevator algorithm to try and evenly distribute the sites into ALBs.
- Enforce Rule Limits
- Unfortunately, elevator algorithms aren’t great at finding a good match every time. So, if adding a site to a bag would bring the total number of evaluation rules over $sharedSiteRuleLimit, then it tries to fit the site into the next bag (and so on).
- Give Options for how the sites will be prioritized for sorting
- Depending on how the sites are sorted before going into the elevator algorithm you can get different results. So, $sortByOptions lets you choose a few ways to sort them and to see the results of each options side by side.
The results look something like this:
So, sort by WebAppCount (ie. # of sub-applications) got it down to 19 ALBs. That’s 6 single ALBs and 13 shared ALBs.
Conclusion:
The cost of 19 ALBs without LCU charges is $307.80 per month ($0.0225 ALB per hour * 24 hours * 30 days * 19 ALBs). Our current IIS proxy server, which can run on a t2.2xlarge EC2 image, would cost $201.92 per month on a prepaid standard 1-year term.
The Sorting PowerShell Script
How to get more accurate groupings:
- Instead of generating hourly request statistics based upon Date, Time, and SiteName; the hourly request statistics need to be based upon Date, Time, SiteName, and AppPath. To do this you would need to:
- Assign a WebAppId to the dbo.ProxyWebApps table
- Write a SQL query that would use the dbo.ProxyWebApps data to evaluate all requests in dbo.IisLogs an assign the WebAppId to every request
- Regenerate all hourly statistics over ALL dimensions using Date, Time, SiteName and AppPath.
- Determine a new algorithm for ALB groupings that would attempt to make the number of rules in each group 10. But, the algorithm should leave extra space for around 1000~1500 (1.0~1.5 LCU) worth of requests per ALB. The applications with the lowest number of requests should be added to the ALBs at this point.
- You need to ensure that all applications with the same SiteName have to be grouped together.
- The base price per hour for an ALB is around 2.8 LCU. So, if you can keep this dimension below 2.8 LCU, it’s cheaper to get charged for the rule evaluations than to create a new ALB.
Next Up, AWS ALB Price Planning W/ IIS : Grouped Sites.
0 comments:
Post a Comment