Posts Tagged ‘performance’

ActiveMQ + Ruby Stomp Client: How to process elements one by one

Posted by Alexey Kovyrin under Admin-tips, Databases, Development, My Projects

Few months ago I’ve switched one of our internal projects from doing synchronous database saves of analytics data to an asynchronous processing using starling + a pool of workers. This was the day when I really understood the power of specialized queue servers. I was using database (mostly, MySQL) for this kind of tasks for years and sometimes (especially under a highly concurrent load) it worked not so fast… Few times I worked with some queue servers, but those were either some small tasks or I didn’t have a time to really get the idea, that specialized queue servers were created just to do these tasks quickly and efficiently.

All this time (few months now) I was using starling noticed really bad thing in how it works: if workers die (really die, or lock on something for a long time, or just start lagging) and queue start growing, the thing could kill your server and you won’t be able to do something about it – it just eats all your memory and this is it. Since then I’ve started looking for a better solution for our queuing, the technology was too cool to give up. I’ve tried 5 or 6 different popular solutions and all of them sucked… They ALL had the same problem – if your queue grows, this is your problem and not queue broker’s :-/ The last solution I’ve tested was ActiveMQ and either I wasn’t able to push it to its limits or it is really so cool, but looks like it does not have this memory problem. So, we’ve started using it recently.

In this small post I’d like to describe a few things that took me pretty long to figure out in ruby Stomp client: how to make queues persistent (really!) and how to process elements one by one with clients’ acknowledgments.
Read the rest of this entry »

Advanced Squid Caching for Rails Applications: Preface

Posted by Alexey Kovyrin under Databases, Development, My Projects, Networks

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.
Read the rest of this entry »

Found an Ideal I/O Scheduler for my MySQL boxes

Posted by Alexey Kovyrin under Admin-tips, Databases

Today I was doing some work on one of our database servers (each of them has 4 SAS disks in RAID10 on an Adaptec controller) and it required huge multi-thread I/O-bound read load. Basically it was a set of parallel full-scan reads from a 300Gb compressed innodb table (yes, we use innodb plugin). Looking at the iostat I saw pretty expected results: 90-100% disk utilization and lots of read operations per second. Then I decided to play around with linux I/O schedulers and try to increase disk subsystem throughput. Here are the results:

Read the rest of this entry »

FastSessions Rails Plugin Released

Posted by Alexey Kovyrin under Databases, Development, My Projects

How often do we think about our http sessions implementation? I mean, do you know, how your currently used sessions-related code will behave when sessions number in your database will grow up to millions (or, even, hundreds of millions) of records? This is one of the things we do not think about. But if you’ll think about it, you’ll notice, that 99% of your session-related operations are read-only and 99% of your sessions writes are not needed. Almost all your sessions table records have the same information: session_id and serialized empty session in the data field.

Looking at this sessions-related situation we have created really simple (and, at the same time, really useful for large Rails projects) plugin, which replaces ActiveRecord-based session store and makes sessions much more effective. Below you can find some information about implementation details and decisions we’ve made in this plugin, but if you just want to try it, then check out our project site.

Read the rest of this entry »

Список 1000 (84) Лучших Советов по Производительности MySQL с MySQL Camp 2006

Posted by Alexey Kovyrin under Development · english

Похоже, что MySQL Camp 2006 был действительно очень интересным и полезным событием как для тех, кто его посетил, так и для всего сообщества MySQL. Как результат этой встречи большого количества профессионалов, связанных с MySQL, появилось множество интересных публикаций. Именно одну из таких публикаций я и хотел бы “прорекламировать” сегодня. Очень интересный список 84 Лучших советов по производительности MySQL был создан в первый день работы MySQL Camp в штабквартире Google:

  1. Index stuff.
  2. Don’t Index Everything
  3. Use benchmarking
  4. Minimize traffic by fetching only what you need.
    • Paging/chunked data retrieval to limit
    • Don’t use SELECT *
    • Be wary of lots of small quick queries if a longer query can be more efficient
  5. Use EXPLAIN to profile the query execution plan
  6. Use Slow Query Log (always have it on!)
  7. Don’t use DISTINCT when you have or could use GROUP BY
  8. Use proper data partitions (For Cluster. Start thinking about Cluster *before* you need them)
  9. Insert performance
    • Batch INSERT and REPLACE
    • Use LOAD DATA instead of INSERT
  10. LIMIT m,n may not be as fast as it sounds

Я думаю, что этот список советов может быть очень полезен всем разработчикам и администраторам, работающим с MySQL и потому хочу сказать “Большое Спасибо” его авторам.

В поисках оптимального решения: Ruby On Rails и Mongrel

Posted by Alexey Kovyrin under Development, Networks · english

Эта статья является частью серии “В поисках оптимального решения“, посвященной тестированию производительности различных схем развертывания приложений на Ruby On Rails. Основной идеей тестирования является поиск подмножества самых оптимальных с точки зрения производительности решений по установке RoR-приложений в различных ситуациях.

Эта небольшая статья посвящена установке связки Rails+Mongrel и ее производительности. Список всех протестированных схем развертывания, описание методики тестирования и результаты всех тестов вы можете найти на странице “Результатов и Выводов“.

Read the rest of this entry »

Варианты настройки Ruby On Rails на максимальную производительность: mongrel vs lighttpd vs nginx

Posted by Alexey Kovyrin under Admin-tips, Development, Networks · english

Из-за возможных ошибок в методике тестирования приведенные результаты могут быть не корректными. Потому бяло принято решение провести тестирование заново с измененными параметрами и набором тестов. Новые результаты тестирования Вы можете получить в серии статей “В Поисках Оптимального Решения” и в статье, описывающей результаты всей серии тестов.

На этой неделе мы начали проект, использующий Ruby on Rails как основное средство разработки. Моей первоочередной задачей являлась настройка окружения на одном из наших development-серверов. Когда я попытался разобраться, как же другие люди запускают и используют RoR, я заметил, что в Internet нет информации о настройке rails-приложений в связке с nginx frontend и нет информации о производительности такого решения. Перед тем, как вслепую выбирать решение для хостинга нового проекта я решил провести небольшое тестирование популярных решений для запуска Rails-приложений. Результаты этих тестов и конфигурационные файлы, использованные при тестировании, вы можете увидеть в этой статье.

Read the rest of this entry »

MySQL Performance Blog – Отличный ресурс для администраторов MySQL

Posted by Alexey Kovyrin under Databases, Development · english

На этой неделе я случайно наткнулся на отличный ресурс Петра Зайцева и Вадима Ткаченко – двоих разработчиков из High Performace Group в MySQL Inc. Их блог называется MySQL Performance Blog и, как Вы уже могли догадаться, в нем рассказывается о различных аспектах оптимизации MySQL и различных вещах, относящихся к оптимизации. Потому, если вы являетесь администратором MySQL или, просто, разработчиком, работающим с MySQL, я хочу настоятельно порекомендовать Вам взглянуть на этот блог – там очень много полезной информации по оптимальной работе с MySQL.