24 Feb 2016, 09:30

Around the Web - February 2016 - MySQL, Docker, Security & Webapps/API

MySQL

Docker

  • Official images are to move from Ubuntu to Alpine : main arguements are about disk space saving (and so bandwith and time to launch a container) and security (lower surface of attack).
    • "Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox" according to the site
    • First, I was sceptical as it requires the whole ecosystem to move from ubuntu to alpine ; indeed, wether you like it or not, people are used to ubuntu/debian and other mainstream distribution and all packages we are used to have are not yet available in alpinelinux also. To be honest, main packages are available.
    • Then, a debian or whatever base image will still exist, be safe with that ; however, if you want to "hack" / inherit from a docker base image, you'll have to switch to Alpine.
    • Third, we could consider that once your docker host has the base image in cache, the ~180M size of base image is not an issue. But starting from 5M may be a good argument however.
    • Starting testing it on ARM device and especially Raspberry Pi, I'm quite pleased with its reactivity and packages available.
  • Some tips to reduce the size of your docker image and also understand how size and layers impacts your docker image. Following the instructions, I could reduce my influxdb-chronograf docker image by 70M approx (from 360 to 290M if I'm correct)

Security & API/Web App

 

26 Nov 2014, 09:30

Around the Web - November 2014

DNS

HTTPS

MySQL

HTML5/CSS/Responsive Web Design

  • 7 CSS Units you may not know about : rem, vh, vm, vmin, vmax, ex and ch. I did not know the two latter. Some more examples for the vh/vm and vmin/vmax.
  • About rem and em more specially, if you want to move from a fixed approach (ie pixel one) to a more fluid/adaptive one (em/rem), you should read this article  and then this one which explain the issue with pixels and the new way to manage it. You can also use em/rem for positionning content ; em/rem are not only about text.
  • 5 obsolete features in HTML5: hgroups tag, pubdate and scope attributes, command and center elements. With the good way to implement them and/or some workaround if you still need them.
  • RWD adoption 2014 : top 100/1000/10.000 sites are evaluated - from to what extend is RWD implemented to mobile site vs RWD benchmarks in terms of performance.
  • 6 technologies that will change the web platform : asm.js, paralleljs, ECMAScript 6, web components, installable webapps, CSS Grid layout
  • The state of Web Animation 2014 : Between the post-Flash area and the Web Animation API to be implemented in all browsers, a review of current challenges and polyfill to bring animations into the browsers. Comments are also worth to read to get more resources.
  • If you are interested in a book about RWD, seems the latest book from A book apart may interested you : Responsible responsive web design (related review)

Browser

Web Performance

  • M6 Tech team made a review of their participation to Velocity conf (day 1, day 2, day 3), a web performance oriented conference. Even if their synthesis is in French, related slides and video are in English. You can also find the one of 2013 (day 1, day 2, day 3)

AngularJS

React (Facebook)

  • React through the ages : an interesting introduction (from origin to what's coming) about React, a JS library to build user interfaces.

18 Sep 2013, 09:30

MySQL/Postgres Roundup 18/9

On MySQL side, or should I say MariaDB one :

  • Google swaps out MySQL, moves to MariaDB : beyond the significative reference for MariaDB and the fact that Google will sustain his effort to patch MariaDB as they did for MySQL, the question that raised for me was : how long will Percona go with MySQL ? Percona's server was seen as an advanced version of MySQL with the inclusion of some patches (like Google's one for performance, etc) and for the tools they provide with/aside (like Percona toolkit or Xtrabackup). It does not seem they plan to make the switch so far...
  • Scaling your database via InnoDB table compression : where you can eliminate slow queries via innodb table compression. Constraints and limits are explained in the post.

On Postgres side :

More generally and even if it's a postgres example which is used, you should use UUIDs for your keys instead of traditionnal keys. Beyond unicity, if you are to use distributed systems, it would be one (or the only ?) way to avoid conflicts.

10 Apr 2013, 22:30

SQL/Database Roundup - 10/4

Spending some time on MySQL these days, time for a SQL/Database roundup :

MySQL

Production

  • If you are interested in MySQL and want to know more about administration, replication, optimisation, etc ; the must read book is High Performance MySQL (I highly recommend it) and you can follow the related blog.
  • Percona provides a bunch of scripts to get information about the status of your database, its health, replication status, etc.
  • Percona provides a bunch of templates/scripts/reports/graphs to integrate with your monitoring solution (Nagios/Cacti) ; it covers mainly MySQL but you also have some for Apache, Nginx, MongoDB, etc.
  • More about Percona MySQL graphs in Cacti which capture all the activity of your MySQL server
  • If you are more interested on Postgres monitoring :

And as a side note, yes, Percona provides also their own MySQL based server with some optimisations and additional features and some other tools

Performance :

  • Indexes : the neglected performance all-rounder : where you will learn obvious things :
    • Defining indexes is part of developper jobs and not DBA
    • Indexes are not taught and poorly documented as it's not strictly part of SQL language
  • Need for speed (in French) : a mix of best practices / tools / methodology on optimisation for your database (mainly postgres)
  • MySQL Tuner : a script that would review your MySQL configuration and makes suggestion to improve performance and stability. Full support up to MySQL 5.1 ; Alike, you also have MySQL Tuning Primer.

19 Feb 2013, 21:21

SQL Filter bypass

A series of (interesting) articles on SQL injection on how to bypass filters :

$Even if most of the cases are available for MySQL and in a PHP context, you may be interesting to have a look at some examples to rethink about the way you do your sql queries based on what you get from your app or the user (via forms or manual url guessing)

31 Jan 2013, 20:58

Database : Use the index, luke !

Disclamier : I'm not a SQL Guru, nor DBA but as I saw the document being quoted several times, it should have some revelancy.

Use the index is about best practices on SQL indexations and optimisations and content is both in English and French :

It concerns all main databases : MySQL, Oracle, Postgresql, IBM DB2 and Microsoft SQL Server 

CHAPTER 1 - Anatomy of an Index

The first chapter is the only one that doesn’t cover SQL specifically; it is about the fundamental structure of an index. An understanding of the index structure is essential to following the later chapters—don’t skip this!

Although the chapter is rather short—only about eight pages—after working through the chapter you will already understand the phenomenon of slow indexes.

CHAPTER 2 - The Where Clause

This is where we pull out all the stops. This chapter explains all aspects of the where clause, from very simple single column lookups to complex clauses for ranges and special cases such as LIKE.

This chapter makes up the main body of the book. Once you learn to use these techniques, you will write much faster SQL.

CHAPTER 3 - Performance and Scalability

This chapter is a little digression about performance measurements and database scalability. See why adding hardware is not the best solution to slow queries.

CHAPTER 4 - The Join Operation

Back to SQL: here you will find an explanation of how to use indexes to perform a fast table join.

CHAPTER 5 - Clustering Data

Have you ever wondered if there is any difference between selecting a single column or all columns? Here is the answer—along with a trick to get even better performance.

CHAPTER 6 - Sorting and Grouping

Even order by and group by can use indexes.

CHAPTER 7 - Partial Results

This chapter explains how to benefit from a “pipelined” execution if you don’t need the full result set.

CHAPTER 8 - Insert, Delete and Update

How do indexes affect write performance? Indexes don’t come for free—use them wisely!

APPENDIX A - Execution Plans

Asking the database how it executes a statement.

APPENDIX B - Myth Directory

Lists some common myth and explains the truth. Will be extended as the book grows.

APPENDIX C - Example Schema

All create and insert statements for the tables from the book.

So you can read the book online or buy it