Optimising Windows Server 2008 R2
07 Jan 2014
Optimising Windows Server 2008 R2 for EC2 micro instance
AWS EC2 micro instances are designed to be suitable for running small web sites. They can provide relatively good performance for short time periods but sustained CPU use will result in the instance being throttled. In order to get best performance running Windows Server on a micro instance we want to remove any unnecessary tasks that will result in sustained CPU use.
Here is a non exhaustive list of the configuration changes that can be made
Disable Windows Update
When Windows Update runs to check for updates it can take a significant length of time. This will be long enough to trigger the AWS CPU throttling. Fortunately Windows Updates are generally released on a schedule usually referred to as ‘Patch Tuesday’. The Microsoft Security TechCenter list a number of ways you can receive notification about impending releases.
Stop SQL Server from auto unloading database
By default SQL Server will unload a database if it has not been used recently. This may make sense on a server used for multiple applications, but on a micro instance we don’t want to incur the penalty of reloading the database.
Stop IIS from shutting down AppPool
IIS will shutdown a worker process in an AppPool if it has been idle for a length of time. The default idle time is 20 minutes
In IIS Manager open the Advanced Settings of the Application Pool, the Idle Time (minutes) setting is in the Process Model section
Extend AppPool restart
By default the AppPool is set to recycle after 29 hours. AppPool recycling can take long enough to trigger AWS CPU throttling. Given that your site is getting few enough hits to run on a micro instance, you should be able significantly increase the recycling timeout.
Use IIS app warmup
Starting the AppPool and your application may take long enough to trigger CPU throttling slowing the response to the user. You can configure IIS to show a static splash page whilst your application is starting up.
Details can be be found here: IIS 8.0 Application Initialization and here: Application Initialization Module for IIS 7.5
robots.txt
The majority of your traffic is likely to come from web crawlers. This will be from search engine bots — which you want, and from a variety of unknown sources. Some of these will crawl your site at a reasonable rate, some will hammer it. If this becomes really problematic you can set rules in IIS to block certain IP address, however most of the problems can be resolved by adding the Crawl-delay directive to your Robot.txt file
Crawl-delay: 10
pt
nopCommerce Database Restore
17 Dec 2013
Restoring an nopCommerce database from backup
-
Download last Full and last Differential backup from S3
Using Microsoft SQL Server Management Studio
-
Using Databases / nopCommerce*** - Tasks / Restore / Databases
Restore Full backup setting Recovery state to RESTORE WITH NORECOVERY
Restore Differential backup setting Recover state to RESTORE WITH RECOVERY
If there is no Differential backup the Full backup should be restored setting Recover state to RESTORE WITH RECOVERY -
Using Databases / nopCommerce* / Security / Users / default* - Delete
Delete the default*** user in the restored database. -
Using Security / Logins / default* - Properties | User Mapping
Map the server login default* to the default* user in the nopCommerce* database -
Using Databases / nopCommerce* / Security / Users / default* - Properties | General
Enable the following Role Members - db_datareader, db_datawriter, db_owner, db_securityadmin
pt
Installing Jekyll using RVM
12 Oct 2013
Installing Jekyll using RVM
Notes from installing Jekyll on Ubuntu 12.04
\curl -sSL https://get.rvm.io | bash -s stable
rvm requirements
rvm install 2.1.0
rvm use 2.1.0
rvm gemset create jekyll
rvm use 2.1.0@jekyll
rvm --ruby-version use 2.1.0@jekyll
gem install jekyll
gem install jekyll-s3
If rvm requirements
fails because the account does not have the necessary persmission to automatically install the dependencies then
rvm autolibs read-fail
rvm requirements
This should list any missing dependencies, you can then install them using an account with the correct permissions and continue the process.
scss support
gem install jekyll-compass
.scss files go in the _sass
folder and are copied to the _site/css
folder
jekyll-s3
gem install jekyll-s3
Contents of _jekyll_s3.yml file
s3_id: ********
s3_secret: ************
s3_bucket: www.example.com
s3_endpoint: EU
gzip: true
pt
Installing Rails on Ubuntu 12.04 TLS
14 Mar 2013
Installing Rails on Ubuntu 12.04 TLS
Notes from installing Ruby 1.9.3 and Rails 3.2 on ubuntu 12.04 TLS
Base
Update the base system and install some necessary packages
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install openssh-server
sudo apt-get install fail2ban
sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install libmysqlclient-dev
Desktop
Install if you want to share files to a desktop OS
sudo apt-get install avahi-daemon
sudo apt-get install samba
sudo smbpasswd -a {USER}
sudo nano /etc/samba/smb.conf (Enable home directories)
sudo service smbd restart && sudo service nmbd restart
RVM
\curl -L https://get.rvm.io | bash -s stable --auto
. ~/.bash_profile
rvm requirements
sudo apt-get --no-install-recommends install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev
rvm install 1.9.3
rvm use 1.9.3 --default
rvm rubygems current
gem install rails
gem install therubyracer
gem install mysql2
gem install rvm-capistrano
gem install whenever
Passenger
gem install passenger
passenger-install-apache2-module
Install the dependencies as directed
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install apache2-prefork-dev
sudo apt-get install libapr1-dev
sudo apt-get install libaprutil1-dev
The edit the Apache configuration file as instructed:
LoadModule passenger_module /home/***/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /home/***/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19
PassengerRuby /home/***/.rvm/wrappers/ruby-1.9.3-p392/ruby
Updating
Updating the version of ruby
rvm get stable
rvm upgrade 1.9.3-p392 1.9.3
rvm use 1.9.3 --default
rvm wrapper 1.9.3 passenger
passenger-install-apache2-module
and update the apache2.conf file as instructed
pt