Skip to content

# Tag: memcached

## MySQL 5.6 new features: the user’s perspective

MySQL InnoDB memcached New Features Opinions Replication October 5, 2012

This is a yet-another compilation of the new MySQL 5.6 feature set. It is not a complete drill down. This list reflects what I believe to be the interesting new features user and usability -wise.

For example, I won’t be listing InnoDB’s split of kernel mutex. I’m assuming it can have a great impact on overall performance due to reducing lock contention; but usability-wise, this is very internal.

The complication is an aggregate of the many announcements and other complications published earlier on. See a reference at the end of this post.

Do note I am not using 5.6 as yet; it is in RC, not GA. I am mostly excited just to write down this list.

#### InnoDB

- Online ALTER TABLE: if there is one major new feature in 5.6 you would want to upgrade for, this would be it. Add columns, drop columns, rename columns, add indexes, drop indexes – now online, while your SELECT, INSERT, UPDATE and DELETE statements are running.
- Transportable tablespace files: copy+paste your_table.ibd files with FLUSH TABLE FOR EXPORT and ALTER TABLE … IMPORT TABLESPACE.
- FULLTEXT: for many, the one thing holding them back from leaving MyISAM behind. Now available in InnoDB with same syntax as with MyISAM.
- Memcached API: access InnoDB data via memcahced protocol, and skip the SQL interface.
- User defined table location: place your tables in your pre-defined location. Place other tables elsewhere. This is something I’ve been asked about for ages.

#### Continue reading » “MySQL 5.6 new features: the user’s perspective”

## On generating unique IDs using LAST_INSERT_ID() and other tools

MySQL memcached NoSQL Performance Query Cache February 2, 2011February 2, 2011

There’s a trick for using LAST_INSERT_ID() to generate sequences in MySQL. Quoting from the Manual:

> 1. Create a table to hold the sequence counter and initialize it:

>        mysql> CREATE TABLE sequence (id INT NOT NULL);
>        mysql> INSERT INTO sequence VALUES (0);

> 2. Use the table to generate sequence numbers like this:

>        mysql> UPDATE sequence SET id=LAST_INSERT_ID(id+1);
>        mysql> SELECT LAST_INSERT_ID();

This trick calls for trouble.

#### Contention

A customer was using this trick to generate unique session IDs for his JBoss sessions. These IDs would eventually be written back to the database in the form of log events. Business go well, and one day the customer adds three new JBoss servers (doubling the amount of webapps). All of a sudden, nothing works quite as it used to. All kinds of queries take long seconds to complete; load average becomes very high. Continue reading » “On generating unique IDs using LAST_INSERT_ID() and other tools”

## Using memcached functions for MySQL; an automated alternative to Query Cache

MySQL memcached python Query Cache Triggers December 15, 2008December 15, 2008

There’s a lot of buzz around memcached. memcached is widely used, and has clients for many programming languages and platforms. TangentOrg have developed a memcached client in the form of MySQL UDFs (User Defined Functions).

I wish to discuss the memcached functions for MySQL: if and how they should be used.

Disclaimer: I do not work with memcached functions for MySQL on a production system; all that is written here reflects my opinion on how things should be done.

With memcached functions for MySQL, we can do the following:

>     SELECT memc_set('mykey', 'The answer is 42');
>     SELECT memc_get('mykey');

(See my previous post on how to install memcached functions for MySQL).

#### In what scenario should we use these functions?

I believe memcached is the right tool for the application level. I am less enthusiastic about using it from MySQL. Sure, pushing it down to MySQL centralizes everything. Instead of having all my application code (PHP, Java etc.) access memcached separately, they can all access one single MySQL node, which gets to access memcached. I see two problems with this approach: Continue reading » “Using memcached functions for MySQL; an automated alternative to Query Cache”

## Installing memcached functions for MySQL

MySQL memcached December 10, 2008December 13, 2008

tangent.org provide a memcached client for MySQL, in the form of UDFs. The provided set of functions allow for connecting to a memcached server, putting values in the cache, getting values, invalidating, utilizing increments etc.

The code is not (yet?) available in binary format, so the libraries need to be compiled and installed manually. Following is a quick installation HOWTO for Linux users. Continue reading » “Installing memcached functions for MySQL”