Search This Blog

Sunday, September 29, 2013

MySQL Storage Engines Comparison

 MyISAM Storage Engine Features(default storage engine)
Storage limits
256TB
Transactions
No
Locking granularity
Table
MVCC
No
Geospatial datatype support
Yes
Geospatial indexing support
Yes
B-tree indexes
Yes
Hash indexes
No
Full-text search indexes
Yes
Clustered indexes
No
Data caches
No
Index caches
Yes
Compressed data
Yes[a]
Encrypted data[b]
Yes
Cluster database support
No
Replication support[c]
Yes
Foreign key support
No
Backup / point-in-time recovery[d]
Yes
Query cache support
Yes
Update statistics for data dictionary
Yes



InnoDB Storage Engine Features
Storage limits
64TB
Transactions
Yes
Locking granularity
Row
MVCC
Yes
Geospatial datatype support
Yes
Geospatial indexing support
No
B-tree indexes
Yes
Hash indexes
No
Full-text search indexes
No
Clustered indexes
Yes
Data caches
Yes
Index caches
Yes
Compressed data
Yes[a]
Encrypted data[b]
Yes
Cluster database support
No
Replication support[c]
Yes
Foreign key support
Yes
Backup / point-in-time recovery[d]
Yes
Query cache support
Yes
Update statistics for data dictionary
Yes




 MEMORY Storage Engine Features
The MEMORY storage engine creates tables with contents that are stored in memory. Formerly, these were known as HEAP tables. MEMORY is the preferred term, although HEAP remains supported for backward compatibility.
Storage limits
RAM
Transactions
No
Locking granularity
Table
MVCC
No
Geospatial datatype support
No
Geospatial indexing support
No
B-tree indexes
Yes
Hash indexes
Yes
Full-text search indexes
No
Clustered indexes
No
Data caches
N/A
Index caches
N/A
Compressed data
No
Encrypted data[a]
Yes
Cluster database support
No
Replication support[b]
Yes
Foreign key support
No
Backup / point-in-time recovery[c]
Yes
Query cache support
Yes
Update statistics for data dictionary
Yes



ARCHIVE Storage Engine Features
The ARCHIVE storage engine is used for storing large amounts of data without indexes in a very small footprint.
Storage limits
None
Transactions
No
Locking granularity
Row
MVCC
No
Geospatial datatype support
Yes
Geospatial indexing support
No
B-tree indexes
No
Hash indexes
No
Full-text search indexes
No
Clustered indexes
No
Data caches
No
Index caches
No
Compressed data
Yes
Encrypted data[a]
Yes
Cluster database support
No
Replication support[b]
Yes
Foreign key support
No
Backup / point-in-time recovery[c]
Yes
Query cache support
Yes
Update statistics for data dictionary
Yes



Others

The BLACKHOLE storage engine acts as a “black hole” that accepts data but throws it away and does not store it. 

The CSV storage engine stores data in text files using comma-separated values format.

The FEDERATED storage engine enables data to be accessed from a remote MySQL database on a local server without using replication or cluster technology. When using a FEDERATED table, queries on the local server are automatically executed on the remote (federated) tables. No data is stored on the local tables.

The EXAMPLE storage engine is a stub engine that does nothing. Its purpose is to serve as an example in the MySQL source code that illustrates how to begin writing new storage engines. As such, it is primarily of interest to developers.

The MERGE storage engine, also known as the MRG_MyISAM engine, is a collection of identical MyISAM tables that can be used as one. “Identical” means that all tables have identical column and index information. You cannot merge MyISAM tables in which the columns are listed in a different order, do not have exactly the same columns, or have the indexes in different order.

The IBMDB2I storage engine is designed as a fully featured transaction-capable storage engine that enables MySQL to store its data in DB2 tables running on IBM i. With the IBMDB2I storage engine, data can be shared between MySQL applications and applications coded for native DB2 for i interfaces.
Apache Solr Installation and Configuration


Installation

1. Download Apache Solr Package (http://www.apache.org/dyn/closer.cgi/lucene/solr/)

2. In shell enter “tar –xvzf apache-solr-x.x.x.tgz” this step will create a folder apache-solr-x.x.x

3. Rename the folder for ease of use “mv apache-solr-x.x.x apache-solr”

4. Install JDK (requires > 1.6.0) can download from sun downloads(http://java.sun.com/javase/downloads/widget/jdk6.jsp)

5. “cd apache-solr/example/”

6. Start the servlet “Java –jar start.jar”, Long list of messages will appear at the end you can see message as follows : INFO: Started SocketConnector @ 0.0.0.0:8983

7. Check for errors in java if so please correct it and restart the server. To Stop the server use “CTRL+C”

8. If everything goes fine you should see a screen as below in your browser



Configuring with MySQL Database

1. Download jdbc driver for mysql (mysql-connector-java-5.1.12-bin.jar) put it in the “lib” folder , this is the one which is responsible for communication between MySQL db and apache Solr

2. Open data-config.xml in your conf folder under example directory (example->conf->data-config.xml) in any text editor

3. Add XML as below



4. Data source is the tag which holds the data about the connecter (which database ,user, password, url, driver etc.,), we can have many data source in a single file and use the name of data source to connect

5. Change the “Query” in the “entity” tag as you want to create index it can also use joins and db functions in it

6. There is another set of tags called “Field” which used to specify what are the column which are returned by the query is going to be used (take care in giving values to name attribute),”Column” attribute is used to map the column name to the name attribute

7. Open “schema.xml” in the same folder search for “fields” tag and remove the content of it and add your columns names as picture below

Interface Vs Abstract Class

Feature
Interface
Abstract class
Multiple inheritance
A class may inherit several interfaces.
A class may inherit only one abstract class.
Default implementation
An interface cannot provide any code, just the signature.
An abstract class can provide complete, default code and/or just the details that have to be overridden.
Access ModfiersAn interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as publicAn abstract class can contain access modifiers for the subs, functions, properties
Core VS Peripheral
Interfaces are used to define the peripheral abilities of a class. In other words both Human and Vehicle can inherit from a IMovable interface.
An abstract class defines the core identity of a class and there it is used for objects of the same type.
Homogeneity
If various implementations only share method signatures then it is better to use Interfaces.
If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.
Speed
Requires more time to find the actual method in the corresponding classes.
Fast
Adding functionality (Versioning)
If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method.
If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.
Fields and ConstantsNo fields can be defined in interfacesAn abstract class can have fields and constrants defined

Hudson in Tomcat

Installation

To install Hudson on Tomcat, simply copy hudson.war to $TOMCAT_HOME/webapps, then access http://yourhost/hudson.
If you are running Tomcat just to host Hudson, then remove everything from $TOMCAT_HOME/webapps, and place hudson.war as ROOT.war. Tomcat should expand this and create the ROOT directory, and you should see Hudson in http://yourhost (if you accepted the Tomcat defaults - http://yourhost:8080) without any additional path. This also works nicely when you set up a virtual host, as it allows a single Tomcat instance to run multiple applications, yet users can still access your hudson with URLs like http://hudson.acme.org/ without any additional path. See the Tomcat documentation for more about how to set up a virtual host.

Upgrade

Simply overwrite your hudson.war with the new version and delete the hudson folder in webapps (exploded war). Tomcat should automatically redeploy the application.

Setting HUDSON_HOME

Before starting Tomcat, set CATALINA_OPTS like this. This can be also used to specify JVM options to increase the heap size:
$ export CATALINA_OPTS="-DHUDSON_HOME=/path/to/hudson_home/ -Xmx512m"
$ catalina.sh start
Or on Tomcat 1.6+ CATALINA_OPTS has been replaced by JAVA_OPTS (Thanks to Ronoaldo Pereira):
$ export JAVA_OPTS="-DHUDSON_HOME=/path/to/hudson_home/ -Xmx512m"
$ catalina.sh start
Or if that fails for some reason, you should still be able to use the environment variable:
$ export HUDSON_HOME=/path/to/hudson_home/
$ catalina.sh start

Increasing Tomcat PermGen space

If you see permgen errors when running Tomcat, edit the catalina.sh file on *NIX systems to assign the following options
JAVA_OPTS="-Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m"
Or on windows use the Configure Tomcat GUI Java panel to set the same additional options and restart Tomcat.

Securing Hudson on Tomcat

Tomcat by default stores the user database in an XML file called $TOMCAT_HOME/conf/tomcat-users.xml. You can add the following lines to this file to create an admin user.
<role rolename="admin"/>
<user username="hudson-admin" password="secret" roles="admin"/>

i18n

Some versions of Tomcat (such as 5.0.28) uses iso-8859-1 to decode URLs, which is in a clear violation of the relevant RFCs. To fix this problem, add the following URIEncoding attribute to the connector definition in $TOMCAT_HOME/conf/server.xml.
<Connector port="8080" URIEncoding="UTF-8"/>

Related reads

  1. Similar instruction for Confluence
  2. John O'Conner's blog entry about his experiment. See Elliotte(id:elharo)'s comment in particular,

Relevant Issues

See the list of issues filed that are specifically marked relevant to Tomcat.
There is also a known issue in Tomcat 6.0.21 to 6.0.26 that may cause some requests to hang.

Tomcat from XAMPP

If you are using XAMPP's tomcat installation, and you have Java > 1.5, then you need to remove the following jars from the common\lib directory, otherwise you will get FileNotFound exceptions from the changelog.xml generator:
xalan.jar
xercesImpl.jar
xercesSamples.jar

Tomcat from Ubuntu

If you get Tomcat from Ubuntu via apt-get, Hudson will report an error citing the security permission issue. This is because Tomcat in Ubuntu comes with the security manager on by default. This can be disabled by modifying /etc/default/tomcat5 (version number will be different depending on which version of Tomcat you install.) See issue #719 for more details.

Tomcat from Debian

Fix security issues adding the next lines at /etc/tomcat5.5/policy.d/04webapps.policy:
grant codeBase "file:/var/lib/tomcat5.5/webapps/hudson/-" {
    permission java.security.AllPermission;
};

Tomcat from Windows

GUI Testing in Windows

Most Windows services -- including those run with the option "Allow service to interact with desktop" in Windows XP and Vista -- do not have access to many of the computer's resources, including the console display.  This may cause Automated GUI Tests to fail if you are running Apache Tomcat as a Windows Service and are doing any GUI testing. This is true at least for AWT and Abbot frameworks.  A typical error might look similar to this:
[junit] \# An unexpected error has been detected by HotSpot Virtual Machine:
[junit] \#
[junit] \# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d07baf4, pid=3260, tid=288
[junit] \#
[junit] \# Java VM: Java HotSpot(TM) Client VM (1.5.0_09-b03 mixed mode, sharing)
[junit] \# Problematic frame:
[junit] \# C [awt.dll+0xbaf4|awt.dll+0xbaf4]
[junit] \#
This limitation can be resolved by not running Tomcat as a Windows Service, but instead through a "Scheduled Task" as an Application that runs at logon. There are several options for doing this, an example would be  to run "$TOMCAT_HOME\bin\tomcat5.exe".  When setting up the scheduled task in Windows Vista consider choosing the check-box for "Run with highest privileges" from the general tab, as this removes the need to always provide administrator privileges and may resolve other issues as well.