Friday, February 01, 2013

iphone 5 plan comparison

iphone 5 plan comparison from globe and smart


I took some time to dissect each iphone plan from both globe and smart.

The spreadsheet below compare the iphone 5 - 16GB plans on unlimited data.



The cheapest plan for the iphone 5 16GB comes from smart but the difference is really not that much especially if you look at the monthly cost. The smart plan also provides a bit more free all texts and minutes. To me, it still boils down to the network where most of your contacts are.



The iphone 5 16GB unit might not meet your storage needs so for an additional 200 pesos per month, you can avail of the iphone 5 32GB. Here, globe takes the lead by a measly 1 peso per month. But in my opinion, smart provides a lot more value in the form of freebies.

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Wednesday, January 23, 2013

Disabling BBU Auto Learn with megacli

We are currently facing performance problems with mysql and I remember reading about RAID BBU Learning causing huge write performance drops. So I wanted to check if the RAID controller on our Master database had this configured.

Step#1: Find out what is the brand/model of the RAID controller installed on the server

I can of course ask accounting to pull-up the delivery receipt to find the brand/model but where is the fun in that. Googling led me to the following commands:


sudo lspci | grep -i raid
04:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 04)

sudo lshw -class storage
description: RAID bus controller
       product: MegaRAID SAS 2108 [Liberator]
       vendor: LSI Logic / Symbios Logic
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: scsi4
       version: 04
       width: 64 bits
       clock: 33MHz
       capabilities: storage pm pciexpress vpd msi msix bus_master cap_list rom
       configuration: driver=megaraid_sas latency=0
       resources: irq:26 ioport:d800(size=256) memory:fae7c000-fae7ffff memory:faec0000-faefffff memory:fae80000-faebffff

Step#2: Install the megacli package to be able to query the raid card for its status

Downloaded the megacli package from the LSI website. But they only provide RPMs so I had to convert them with:

sudo alien -k MegaCli-8.07.06-1.noarch.rpm

Then installed with:

sudo dpkg -i megacli_8.07.06-1_all.deb

To find out where the files got installed do:

sudo dpkg -c megacli_8.07.06-1_all.deb

Step#3: Use megacli to probe for BBU status and information

Running the command results to something unexpected:

./MegaCli64 -adpCount
Controller Count: 0.
Exit Code: 0x00

megacli cant find the raid adapter. It seems that megacli has an issue with kernels >= 3.0 and can be remedied with:

sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -adpCount
Controller Count: 1.
Exit Code: 0x01

So to find out about the BBU:

sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL

BBU status for Adapter: 0

BatteryType: iBBU
Voltage: 3972 mV
Current: 0 mA
Temperature: 24 C
Battery State: Optimal
BBU Firmware Status:

  Charging Status              : None
  Voltage                                 : OK
  Temperature                             : OK
  Learn Cycle Requested                  : No
  Learn Cycle Active                      : No
  Learn Cycle Status                      : OK
  Learn Cycle Timeout                     : No
  I2c Errors Detected                     : No
  Battery Pack Missing                    : No
  Battery Replacement required            : No
  Remaining Capacity Low                  : No
  Periodic Learn Required                 : No
  Transparent Learn                       : No
  No space to cache offload               : No
  Pack is about to fail & should be replaced : No
  Cache Offload premium feature required  : No
  Module microcode update required        : No


GasGuageStatus:
  Fully Discharged        : No
  Fully Charged           : Yes
  Discharging             : Yes
  Initialized             : Yes
  Remaining Time Alarm    : No
  Discharge Terminated    : No
  Over Temperature        : No
  Charging Terminated     : No
  Over Charged            : No
  Relative State of Charge: 97 %
  Charger System State: 49168
  Charger System Ctrl: 0
  Charging current: 0 mA
  Absolute state of charge: 53 %
  Max Error: 2 %

Exit Code: 0x00

sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuCapacityInfo -aALL

BBU Capacity Info for Adapter: 0

  Relative State of Charge: 97 %
  Absolute State of charge: 53 %
  Remaining Capacity: 641 mAh
  Full Charge Capacity: 664 mAh
  Run time to empty: Battery is not being discharged.  
  Average time to empty: Battery is not being discharged.  
  Estimated Time to full recharge: Battery is not being charged.  
  Cycle Count: 37
Max Error = 2 %
Remaining Capacity Alarm = 120 mAh
Remining Time Alarm = 10 Min

Exit Code: 0x00

sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuProperties -aALL

BBU Properties for Adapter: 0
  Auto Learn Period: 30 Days
  Next Learn time: Sun Feb 17 19:37:09 2013
  Learn Delay Interval:0 Hours
  Auto-Learn Mode: Enabled
Exit Code: 0x00

Auto learn mode should be disabled and scheduled during off-peak time.

#!/bin/bash
TMPFILE=$(mktemp -p /tmp bbu.relearn.XXXXXXXXXX) || exit 1
echo "autoLearnMode=1" > $TMPFILE
setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -SetBbuProperties -f $TMPFILE -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuProperties -aALL
rm $TMPFILE

script for safe write back:


#!/bin/bash
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp ADRA -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Cached -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp DisDskCache -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp NoCachedBadBBU -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp WB -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL


script to force write back without BBU protection:

#!/bin/bash
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp ADRA -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Cached -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp DisDskCache -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp CachedBadBBU -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp WB -Lall -aALL
sudo setarch x86_64 --uname-2.6 /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL


Useful Links:
http://linux.dell.com/files/whitepapers/solaris/Managing_PERC6_0714.pdf
http://hwraid.le-vert.net/wiki/LSIMegaRAIDSAS
http://yo61.com/dell-drac-bbu-auto-learn-tests-kill-disk-performance.html


I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Wednesday, November 21, 2012

Transferring a huge file over a LAN

We need to transfer several huge files from an old server to a new server. I plan to use netcat to do a raw transfer followed by rsync to ensure data integrity. I'll report back on the results.


On the destination server:
nc -l 1234 > ubuntu-12.04.1-server-i386.iso


On the source server:
time cat ubuntu-12.04.1-server-i386.iso | nc $DESTINATION_IP 1234


On the source server:
cat >rsyncd.conf <<EOF
#rsyncd.conf
[temp]
path=/var/lib/libvirt/images/
read only = yes
list = yes
use chroot = no
EOF
rsync --config=rsyncd.conf --daemon --no-detach --port=1234


On the destination server:
time rsync -av --inplace --progress rsync://apollo@192.168.7.167:1234/temp/ubuntu-12.04.1-server-i386.iso ubuntu-12.04.1-server-i386.iso

Update#1:

time cat ubuntu-12.04.1-server-i386.iso | nc 192.168.7.198 1234

real 0m58.130s
user 0m0.072s
sys 0m2.016s

ubuntu-12.04.1-server-i386.iso is 646MB in size which gives a transfer rate of 11.13MB/s which is NOT what I expected from a gigabit connection.



I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.


Monday, April 30, 2012

Safely Rebooting a Hanging Server


When all else fails, go to the physical server console and hit:
Alt-SysRq R (wait for 21 secs)
Alt-SysRq E (wait for 21 secs)
Alt-SysRq I (wait for 21 secs)
Alt-SysRq S (wait for 21 secs)
Alt-SysRq U (wait for 21 secs)
Alt-SysRq B

Then cross your fingers as the server should reboot

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Friday, April 13, 2012

Problem with grails, maven and spring security

Environment:
Ubuntu 12.04 3.2.0-20-generic-pae kernel
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-3ubuntu3)
OpenJDK Server VM (build 20.0-b12, mixed mode)

I installed STS 2.9.1 RELEASE which includes apache-maven-3.0.3

I placed the apache-maven-3.0.3 in my PATH environment variable

I created a project with:
mvn archetype:generate \
-DarchetypeGroupId=org.grails \
-DarchetypeArtifactId=grails-maven-archetype \
-DarchetypeVersion=1.3.7 \
-Dversion=1.0.0alpha \
-DgroupId=com.henyo.foobar -DartifactId=foobar

mvn proceeded to download the internet and then created the project folder with the pom file
I modified the pom file to set the source and target to 1.6 as described in the grails manual

I then did:
mvn initialize
which created the grails directory structure

I tried:
mvn grails:run-app
which resulted in the app successfully running

I then tried running just the unit tests with:
mvn grails:exec -Dcommand=test-app -Dargs="--unit"
which resulted in successful build

I then installed the spring security core plugin with:
mvn grails:install-plugin -DpluginName=spring-securit-core

I then tried using the s2-quickstart script:
mvn grails:exec -Dcommand=s2-quickstart -Dargs="com.henyo.foobar.model User Role"
which resulted in a build FAILURE:
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:1.3.7:exec (default-cli) on project foobar: Unable to start Grails: java.lang.reflect.InvocationTargetException: org/springframework/security/core/Authentication: org.springframework.security.core.Authentication -> [Help 1]

It seems that the grails maven integration still needs a lot of work. I suspect this is a dependency resolution issue.

Uploaded a sample project that has this issue: http://dl.dropbox.com/u/5541070/foobar.tar.gz

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Books for Software Development


My updated reading list

Learning Programming
-------------
How to think like a computer scientist: Python Edition
Thinking in C beta 3
The Passionate Programmer


Learning Java
-------------
How to think like a computer scientist: Java Edition
Objects First with Java
Head First Java 2nd Ed
Thinking in Java 4th Ed
Big Java
Agile Java: Crafting Code with Test-Driven Development
Core Java Vol 1 & 2
The Art & Science of Java
The Java Programming Language

Programming Practices
---------------------
The Pragmatic Programmer: From Journeyman to Master
Pragmatic Version control using git
Pragmatic Unit testing in Java with JUnit
Pragmatic Project Automation
Debug It
Ship it
Release it

Learning Basic Web Frontend Development
---------------------------------------
Head First HTML with CSS & XHTML
Head First Javascript
Javascript the Good Parts
Stylin' with CSS: A Designer's Guide (2nd Edition)
Designing with Web Standards by Jeffrey Zeldman and Ethan Marcotte
Web Design for Developers: A Programmer's Guide to Design Tools and Techniques by Brian P. Hogan
Eric Meyer on CSS: Mastering the Language of Web Design by Eric Meyer
JQuery in Action by Bear Bibeault and Yehuda Katz
Handcrafted CSS by Dan Cederholm with Ethan Marcotte

Learning Swing Frontend Development
-----------------------------------
Desktop Java Live
Swing Second Edition
Java Swing

Mastering Software Development
------------------------------
Head First Object-Oriented Analysis and Design
Program Development in Java
The Elements of Java(TM) Style
Effective Java
Practical Java
Code Complete: A practical handbook of Software Construction
Clean Code: A Handbook of Agile Software Craftsmanship
Head First Design Patterns
Design Patterns: Elements of Reusable Object-Oriented Software
Patterns of Enterprise Application Architecture
Domain-Driven Design
Refactoring: Improving the Design of Existing Code
Refactoring to Patterns
SQL Anti-patterns
Modular Java
Growing Object-Oriented Software Guided by Tests
Holub on Patterns:Learning Design Patterns by Looking at Code
Test Driven Development by Kent Beck
XUnit Test Patterns - Refactoring Test Code by Gerard Meszaros

Methodology and Management
--------------------------
UML Distilled, 2nd Edition
Extreme Programming Explained
The Unified Software Development Process
Rapid Development: Taming Wild Software Schedules
Peopleware: Productive Projects and Teams
The Mythical Man-Month
Software Runaways: Monumental Software Disasters
Software Creativity
Agile Estimating and Planning by Mike Cohn
Agile Software Development, Principles, Patterns, and Practices by Robert (Bob) C. Martin
Agile Retrospectives: Making Good Teams Great by Esther Derby, Diana Larsen, and Ken Schwaber
Succeeding with Agile: Software Development Using Scrum by Mike Cohn
Agile Testing: A Practical Guide for Testers and Agile Teams by Lisa Crispin and Janet Gregory
Extreme Programming Installed by Ron Jeffries, Ann Anderson, and Chet Hendrickson
Behind Closed Doors: Secrets of Great Management by Johanna Rothman, and Esther Derby
Leading Lean Software Development: Results Are Not the Point by Mary and Tom Poppendieck
Lean-Agile Software Development: Achieving Enterprise Agility by Alan Shalloway, Guy Beaver, and James R. Trott
The Art of Agile Development by James Shore and Shane Warden

Mastering Groovy and Grails
---------------------------
Groovy in Action
The Definitive Guide to Grails
Grails in Action
Groovy Recipes
Programming Groovy

Mastering Web Design
--------------------
Web Design for Developers
Head First Web Design
Designing Web Usability

Mastering User Interface Design
-------------------------------
User Interface Design for Programmers
Don't Make me Think
About Face: The Essentials of User Interface Design
Design of Everyday Things
The Non-Designer's Design Book

Mastering Hardcore Stuff
------------------------
Code: The Hidden Language of Computer Hardware and Software by Charles Petzold
The C Programming Language
Structure and Interpretation of Computer Programs
Introduction to Algorithms by CLRS (Cormen,Leiserson,Rivest,Stein)
Compilers: Principles, Techniques and Tools
Test Driven Development for Embedded C
The Art of Computer Programming


You are also welcome to subscribe via email or subscribe via reader to get updates.