Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 17

Displaying posts with tag: memcache (reset)

When it’s faster to use SQL in MySQL NDB Cluster over memcache API
+3 Vote Up -0Vote Down

Memcache access for MySQL Cluster (or NDBCluster) provides faster access to the data because it avoids the SQL parsing overhead for simple lookups – which is a great feature. But what happens if I try to get multiple records via memcache API (multi-GET) and via SQL (SELECT with IN())? I’ve encountered this a few times now, so I decided to blog about it. I did a very simple benchmark with the following script:

#!/bin/bash
mysql_server="192.168.56.75"
mc_server="192.168.56.75"
mysql_cmd="mysql -h${mysql_server} --silent --silent"
mysql_schema="percona"
mysql_table="memcache_t"
mc_port=11211
mc_prefix="mt:"
function populate_data () {
  nrec=$1
  $mysql_cmd -e "delete from ${mysql_table};" $mysql_schema > /dev/null 2>&1
  for rec in `seq 1 $nrec`
  do
    $mysql_cmd -e "insert into ${mysql_table} values ($rec,
  [Read more...]
1.5x … 9x faster queries with PHP and MySQL 5.6, really?
Employee +0 Vote Up -0Vote Down

I am telling no secret saying MySQL 5.6 GA can be expected to be released soon, very soon. Time to test one of the improvements: MySQL 5.6 speaks SQL and Memcache protocol. In your PHP MySQL apps, try using the Memcache protocol to query MySQL. A key-value SELECT ... FROM ... WHERE pk = <key> can become 1.5x-2x faster, an INSERT INTO table(pk, ...) VALUES (<key> ...) can become 4.5x-9x faster, says the InnoDB team! Read on: background, benchmark, usage, PECL/mysqlnd_memcache,

  [Read more...]
Stop Disabling SELinux!
+0 Vote Up -1Vote Down

I see a lot of people coming by #centos and similar channels asking for help when they’re experiencing a problem with their Linux system. It amazes me how many people describe their problem, and then say something along the lines of, “and I disabled SELinux...”. Most of the time SELinux has nothing to do with the problem, and if SELinux is the cause of the problem, why would you throw out the extra security by disabling it completely rather than configuring it to work with your application?

read more

High Performance PHP Session Storage on Scale
Employee +1 Vote Up -0Vote Down

One of the great things about the HTTP protocol, besides status code 418, is that it's stateless. A web server therefore is not required to store any information on the user or allocate resources for a user after the individual request is done. By that a single web server can handle many many many different users easily, and well if it can't anymore one can add a new server, put a simple load balancer in front and scale out. Each of those web servers then handles its requests without the need for communication which leads to linear scaling (assuming network provides enough bandwidth etc.).

Now the Web isn't used for serving static documents only anymore but we have all these fancy web apps. And those applications often have the need for a state. The most trivial information they need is the current user.

  [Read more...]
5 Tips to Cache Websites and Boost Speed
+0 Vote Up -0Vote Down

Read the original article at 5 Tips to Cache Websites and Boost Speed

Often when we think about speeding up and scaling, we focus on the application layer itself.  We look at the webserver tier, and database tier, and optimize the most resource intensive pages.

There's much more we can do to speed things up, if we only turn over the right stones.  Whether you're using WordPress or not, many of these principals can be applied.  However we'll use WordPress as our test case.

Test Your Website speed

There are web-based speed testing tools that will help with this

  [Read more...]
Not only SQL - memcache and MySQL 5.6
Employee +2 Vote Up -0Vote Down

This week there are two big events for the MySQL community: The O'Reilly MySQL Conference and Oracle Collaborate run by the IOUG. At these events our Engineering VP, Tomas Ulin, announced the latest milestone releases for our main products. MySQL 5.6 and MySQL Cluster 7.1 as well as our new Windows Installer. There's lots of cool stuff in there but one feature really excited me: MySQL 5.6 contains a memcache interface for accessing InnoDB tables. This means you can access data stored in MySQL not only using SQL statements but also by using a well established and known noSQL protocol.

This works by having the memcache daemon running as plugin as part of the MySQL server. This daemon can then be configured in three ways: Either


      [Read more...]
    HandlerSocket is great, but don't compare it to Memcache just yet.
    +1 Vote Up -0Vote Down
    The HandlerSocket plugin for MySQL currently lacks atomic operations .  It is impossible to implement counters (increment/decrement value) or REPLACE functionality with the current implementation. 

    It currently exceeds the performance of Memcache for get/set operations, but I want to see how fast it is once atomic operations are implemented. Until then, I don't think it is a serious contender for replacing Memcache for the cache layer in a complex environment.
    Caching could be the last thing you want to do
    +6 Vote Up -0Vote Down

    I recently had a run-in with a very popular PHP ecommerce package which makes me want to voice a recurring mistake I see in how many web applications are architected.

    What is that mistake?

    The ecommerce package I was working with depended on caching.  Out of the box it couldn't serve 10 pages/second unless I enabled some features which were designed to be "optional" (but clearly they weren't).

    I think with great tools like memcached it is easy to get carried away and use it as the mallet for every performance problem, but in many cases it should not be your first choice.  Here is why:

    • Caching might not work for all visitors - You look at a page, it loads fast.  But is this the same for every user?  Caching can sometimes be an optimization that makes the average user have a


      [Read more...]
    Redis, Memcached, Tokyo Tyrant and MySQL comparision
    +1 Vote Up -4Vote Down

    I wanted to compare the following DBs, NoSQLs and caching solutions for speed and connections. Tested the following

    My test had the following criteria

    • 2 client boxes
    • All clients connecting to the server using Python
    • Used Python's threads to create concurrency
    • Each thread made 10,000 open-close connections to the server
    • The server was
      • Intel(R) Pentium(R) D CPU 3.00GHz
      • Fedora 10 32bit
      [Read more...]
    Storage Miniconf Deadline Extended!
    +0 Vote Up -0Vote Down

    The linux.conf.au organisers have given all miniconfs an additional few weeks to spruik for more proposal submissions, huzzah!

    So if you didn’t submit a proposal because you weren’t sure whether you’d be able to attend LCA2010, you now have until October 23 to convince your boss to send you and get your proposal in.

    libmemcached packages
    +0 Vote Up -0Vote Down

    Ronald Bradford last week posted about memcached not being multi-threaded on Ubuntu, something he discovered via some small utilities that are bundled with libmemcached, written by Brian Aker.

    When I noticed there were no Ubuntu packages for libmemcached (or the CLI tools) I decided to create some.

    For your enjoyment: http://ubuntu.cafuego.net/dists/jaunty-cafuego/memcached/ (Source debs are included)

    The repository also contains a memcached that has been re-compiled with multithreading enabled.

    The rise of the GLAMMP stack
    +1 Vote Up -0Vote Down
    First there was LAMP.  But are you using GLAMMP?  You have probably not heard of it because we just coined the term while chatting at work.  You know LAMP (Linux, Apache, MySQL and PHP or Perl and sometimes Python). So, what are the extra letters for?

    The G is for Gearman - Gearman is a system to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance lots of function calls, or to call functions between languages.

    The extra M is for Memcached - memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by



      [Read more...]
    PHP, Python Consistent Hashing
    +0 Vote Up -0Vote Down

    I found out the hashing algorithm used in PHP-Memcache is different from that of Python-Memcache. The keys went to different servers as the hash created by python and php were different.

    I posted a question on the memcache groups and was lucky to find this wonderful reply.

    import memcache
    import binascii
    m = memcache.Client(['192.168.28.7:11211', '192.168.28.8:11211
    ', '192.168.28.9:11211'])
    
    def php_hash(key):
        return (binascii.crc32(key) >> 16) & 0x7fff
    
    for i in range(30):
           key = 'key' + str(i)
           a = m.get((php_hash(key), key))
           print i, a
    

    This is the only thing that has to be done on Python's end, change the way the hash is calculated. The coding on PHP end remains same. All you guys using PHP for web based front-end with MySQL and Python for back-end scripts shall find this helpful.

    Thanks Brian Rue.

      [Read more...]
    Advanced Squid Caching for Rails Applications: Preface
    +0 Vote Up -0Vote Down

    Since the day one when I joined Scribd, I was thinking about the fact that 90+% of our traffic is going to the document view pages, which is a single action in our documents controller. I was wondering how could we improve this action responsiveness and make our users happier.

    Few times I was creating a git branches and hacking this action trying to implement some sort of page-level caching to make things faster. But all the time results weren’t as good as I’d like them to be. So, branches were sitting there and waiting for a better idea.

    Few months ago my good friend has joined Scribd and we’ve started thinking on this problem together. As the result of our brainstorming we’ve managed to figure out what were the problems

      [Read more...]
    How Facebook serves pictures
    +0 Vote Up -0Vote Down

    I caught Facebook - Needle in a Haystack: Efficient Storage of Billions of Photos on Flowgram. First up, I’m not a big fan of Flowgrams - the format is sensible, slide and voice, is excellent, but the delivery in a web browser isn’t optimal… make downloadable videos!

    The talk however, was excellent. Do watch it, and learn a bit more about Facebook’s infrastructure. Anyway, some notes I took from the talk:

    • “We’re one of the largest MySQL installations in the world”
    • Use memcache - “We have memcache because databases aren’t fast” (later on in the questions)
    • Separate team focusing on APE (Apache, PHP and Extensions that they work on)
    • 6.5 billion total images, 4-5 sizes stored for each, so 30 billion files, of
      [Read more...]
    Dog-pile Effect and How to Avoid it with Ruby on Rails memcache-client Patch
    +0 Vote Up -0Vote Down

    We were using memcache in our application for a long time and it helped a lot to reduce DB servers load on some huge queries. But there was a problem (sometimes called a “dog-pile effect”) - when some cached value was expired and we had a huge traffic, sometimes too many threads in our application were trying to calculate new value to cache it.

    For example, if you have some simple but really bad query like

    SELECT COUNT(*) FROM some_table WHERE some_flag = X

    which could be really slow on a huge tables, and your cache expires, then ALL your clients calling a page with this counter will end up waiting for this counter to be updated. Sometimes there could be tens or even hundreds of such a queries

      [Read more...]
    Useful Cacti Templates to Monitor Your Servers
    +0 Vote Up -0Vote Down

    Recently I had one customer for consulting and aside from mysql optimization, etc they asked me for cacti installation/setup to monitor their pretty generic LAMP application. I’ve started setting up all this stuff and I’ve never thought it could be so painful… lots of different templates for the same tasks, all of them are incompatible with recent cacti releases, etc, etc… So, this post is generally a list of used templates with a fixes I’ve made to make them work on recent cacti release.

    (more…)

    Showing entries 1 to 17

    Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

    Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.