The Lambert Effect – Subtleties in Cloud Modeling

threemodelsAfter you’ve done all of the hard work in creating the perfect model that fits your data comes the hard part: does it make sense? Have you overly fitted your data? Are the results confirming or surprising? If surprising, is that because there’s a surprise or your model is broken?

Here’s an example: iterating on the same CloudForms data as the past few posts, we have subtle variations on the relationship between CPU and memory usage shown through linear regressions with R. Grey dashed = relationship across all servers/VMs and data points, without any taking into account per server variance; and says generally more CPU usage indicates more memory consumed. Blue dashed = taking into account variance of the intercept but not slope of the variance (using factor() in lm()); and reinforces the CPU/memory relationship, but suggests it’s not as strong as the previous model. The black line varies both slope and intercept by server/VM with lmer().

So what’s the best model? Good question, I’m looking for input. I’d like a model that I can generalize to new VMs, which suggests one of the two less fitted models.

Many thanks to Edwin Lambert who, many years ago, beat into my skull that understanding, not numbers, is the goal.

Determining Application Performance Profiles in the Cloud

I want to know how to characterize my workloads in the cloud. With that, I should be able to find systems both over-provisioned and resource starved to aid in right-sizing and capacity planning. CloudForms by Red Hat can do these at the system level, which is where you would most likely take any actions, but I want to see if there’s any additional value in understanding at the aggregate level. cpuWe’ll work backwards for the impatient. I found 7 unique workload types by creating clusters of cpu, mem, disk, and network use through k-means of the short-term data from CloudForms (see the RGB/Gray graph nearby).  The cluster numbers are arbitrary, but ordered by median cpu usage from least to most.

From left to right, rough characterizations of the clusters are:

  1. idle
  2. light use, memory driven
  3. light use, cpu driven
  4. moderate use
  5. moderate-high everything
  6. high cpu, moderate mem, high disk
  7. cpu bound, very high memory
    Continue reading “Determining Application Performance Profiles in the Cloud”

Analyzing Cloud Performance with CloudForms and R

weeklyCloudForms by Red Hat has extensive reporting and predictive analysis built into the product. But what if you already have a reporting engine? Or want to do analysis not already built into the system? This project was created as an example of using Cloud Forms with external reporting tools (our example uses R). Take special care that you can miss context to the data, as there is a lot of state built into the product, and for guaranteed correctness, use the builtin “integrate” functionality.

Both the data collection and the analyses are fast for what they are, but aren’t particularly quick. Be patient: calculating the CPU confidence intervals of 73,000 values across 120 systems took about 90 seconds (elapsed time) on a 2011 laptop.

Required R libraries
forecast
DBI
RPostgreSQL
Installing RPostgreSQL required postgresql-devel rpm on my Fedora 14 box

See: collect.R for example to get started. Full code is available on github.

Notes on confidence intervals
Confidence intervals are the “strength” of likelihood # a value with fall within a given range. The 80% confidence interval is the set of values expected to fall within the range 80% of the time. It is a smaller range than the 95% interval, and should be considered more likely. E.g. if are going to hit your memory threshold within the 80% interval, look to address those limits before those that only fall within the 95% interval.

Notes on frequencies
Frequencies within the functions included are multiples of collected data. Short term metrics are collected at 20 second intervals. Rollup
metrics are 1 hour intervals. Example: for 1 minute intervals with short term metrics, use frequency of 3.

Notes of fields
These are column names from the CF db. The default field is cpu_usage_rate_average. I also recommend looking at mem_usage_absolute_average.

Notes on graphs
Graphs for the systems are shown for the first X systems (up to “max”) with sufficient data to perform the analysis (# of data points > frequency * 2) and that have a range of data, e.g. min < max. Red point = min, blue point = max.

Example images
*.raw.png are generated from the short term metrics. The others from the rollup data.

City Green as a Function of City Parks

Naturehoods Explorer :: Stanford UniversityI stumbled across the City Nature project at Stanford via some interesting interactive data visualization they have created like the comparison between natural and social variables and the Naturehoods Explorer for 34 US cities.

One of the comments in the comparison chart (first project link), was lack of clear relationships between any of the provided variables. As I’m a glutton for punishment, I thought I’d give it a go.

With the addition of only two variables at the City level to the data provided by the Naturehoods Explorer, I was able to get a good start on a linear regression model. The two variables added are city population and number of parks in the city.

Below are results to linear regression models through R.

> summary(lm(park_count ~ . , data =g2))

Call:
lm(formula = park_count ~ ., data = g2)

Residuals:
    Min      1Q  Median      3Q     Max 
-267.25  -42.72   -2.30   56.81  189.01 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  5.636e+01  4.260e+01   1.323 0.185897    
greenness    4.061e+02  3.640e+01  11.157  < 2e-16 ***
pavedness   -1.881e+01  1.861e+01  -1.011 0.312164    
pct_park    -7.069e+01  1.416e+01  -4.994 6.30e-07 ***
park_need   -7.382e+00  4.833e+00  -1.528 0.126742    
popdens      4.525e-04  1.780e-04   2.542 0.011090 *  
h_inc        5.544e-04  1.293e-04   4.288 1.87e-05 ***
home_val    -2.578e-04  2.129e-05 -12.110  < 2e-16 ***
pct_own      4.294e+01  1.184e+01   3.627 0.000292 ***
diversity    5.461e-01  9.816e-02   5.563 2.91e-08 ***
nonwhite    -8.912e+01  7.936e+00 -11.230  < 2e-16 ***
parkspeak   -2.449e+02  3.087e+01  -7.933 3.12e-15 ***
lng         -6.429e-02  1.508e-01  -0.426 0.669870    
lat         -7.898e+00  3.937e-01 -20.060  < 2e-16 ***
population   1.649e-05  1.372e-06  12.023  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 77.24 on 2646 degrees of freedom
Multiple R-squared: 0.447,	Adjusted R-squared: 0.4441 
F-statistic: 152.8 on 14 and 2646 DF,  p-value: < 2.2e-16

I also normalized the fields, except park_count, to get a feel of the relative impact of the individual variables across their very different scales.  The estimate indicates a change by one standard deviation of the variable.

> summary(lm(park_count ~ . , data =g3))

Call:
lm(formula = park_count ~ ., data = g3)

Residuals:
    Min      1Q  Median      3Q     Max 
-267.25  -42.72   -2.30   56.81  189.01 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 152.7865     1.4973 102.043  < 2e-16 ***
greenness    21.2528     1.9048  11.157  < 2e-16 ***
pavedness    -2.1510     2.1278  -1.011 0.312164    
pct_park     -8.3974     1.6815  -4.994 6.30e-07 ***
park_need    -2.8265     1.8503  -1.528 0.126742    
popdens       6.0435     2.3778   2.542 0.011090 *  
h_inc        15.4520     3.6039   4.288 1.87e-05 ***
home_val    -43.8665     3.6222 -12.110  < 2e-16 ***
pct_own       8.2300     2.2691   3.627 0.000292 ***
diversity    11.1726     2.0082   5.563 2.91e-08 ***
nonwhite    -21.6853     1.9311 -11.230  < 2e-16 ***
parkspeak   -14.3325     1.8066  -7.933 3.12e-15 ***
lng          -0.9985     2.3418  -0.426 0.669870    
lat         -40.1728     2.0026 -20.060  < 2e-16 ***
population   28.5058     2.3710  12.023  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 77.24 on 2646 degrees of freedom
Multiple R-squared: 0.447,	Adjusted R-squared: 0.4441 
F-statistic: 152.8 on 14 and 2646 DF,  p-value: < 2.2e-16

For explanations of the data, collection method, etc., please see the City Nature Project.

Data updated with new city vaules in csv format

Load Volatility and Resource Planning for your Cloud

Having your own cloud does not mean you are out of the resource planning business, but it does make the job a lot easier. If you collect the right data, with the application of some well understood statistical practices, you can break the work down into two different tasks: supporting workload volatility and resource planning.

If the usage of our applications was changing in a predictable fashion, resource planning would be easy.  But that’s not always the case, and volatility can make it very difficult to tell what is a short term change and what is part of a long term trend.  Here are some steps to help you prioritize systems for consolidation, get ahead of future capacity problems, and understand long term trends to assist in purchasing behaviors. Our example is with data extracted from Red Hat’s ManageIQ cloud management software.

Usually, we collect and see our performance over X periods of time, where X is a small number and we don’t get much insight. More data points are help, but require a lot of storage. ManageIQ natively provides data rollup of metrics, to provide a great balance between the two.  Since we want to compare short term to long term for trends, we lose little using the rollup data.

shorttermOur graphs look at the CPU utilization history of four systems. The first graph looks only at the short term data, smoothed (using a process similar to the one described here) over one minute intervals. We smooth the data to reduce the impact of intra-period volatility on our predictions. The method described corrects for “seasonality” within the periods, e.g. CPU utilization on Mondays could be predictably higher than on Tuesdays as customers come back to work and get things done they could not over the weekend. The blue dot is the highest utilization, and red, the lowest over the period. Continue reading “Load Volatility and Resource Planning for your Cloud”