Cómo me quedé sin teléfono (V)

Este verano estuve un par de semanas sin teléfono, por culpa de una portabilidad. Partes I, II, III, y IV

Me intentaron vender un teléfono que yo no quería sin permitirme cambiarlo. Me dieron tres precios diferentes para el mismo terminal… toca reclamar.

Reclamaciones

Es el momento de ponerse en contacto con la companía de telecomunicaciones.

Puesto que el proceso de portabilidad se ha realizado a través de un distribuidor, desde el operador no «pueden» hacer nada. Saber eso, me cuesta dos horas y cinco llamadas.

En el distribuidor me prometen ponerse en contacto conmigo al día siguiente para solucionar mi problema.

Al día siguiente me quedo sin teléfono, el proceso de portabilidad ha finalizado.

Después de mucho pelearme con el servicio telefónico consigo sacarles que el distribuidor puede cambiarme el teléfono. Respuesta del distribuidor: «Entonces pierdo 500 euros»…

Resulta que el distribuidor ha cometido un fallo, y en vez de solucionarlo humildemente, me pone más problemas para que me acojone y deje de quejarme.

El distribuidor al final accede a realizar el cambio, pero no puede asegurar cuándo recibirá terminales. Los dos terminales que tenían ya los han repartido a otros clientes.

Por si acaso, me llevo escrito este acuerdo en una hoja de reclamaciones.

Cómo me quedé sin teléfono (IV)

Este verano estuve un par de semanas sin teléfono, por culpa de una portabilidad. Partes I, II, y III

Me prometieron un teléfono que yo creía que era difícil de conseguir, me cambiaron el precio el día antes de ir a recogerlo, y aún así quise seguir adelante con la portabilidad.

El gran día

Y llegó el gran día.

Acudo a la otra tienda del distribuidor a recoger mi terminal. Y… ¡Sorpresa! Allí nadie sabe que me tienen que cambiar el terminal. De hecho…

¡¡¡Mi terminal no se puede cambiar!!!

Si me hubieran avisado antes hubiera cancelado la portabilidad. Ahora no es posible técnicamente, ya que queda demasiado poco para que sea efectiva.

Más preocupante es cuando me dice la dependienta:

«Pero si el teléfono que has pedido no lo tenemos en catálogo…»

Me he quedado sin el teléfono que quería, nadie me había dicho que no lo tenían, y no me ofrecían ninguna solución.¿Podría ser peor? Sí.

En la tienda disponen de dos terminales como el que solicité, pero en otro color. Pregunto por ellos.

«Pero ese terminal no es gratis, tienes que abonar 99€.»

Tercer cambio de precio en tres días. ¿Alguien da más?

Continuará… (con final feliz)

Blaapps 0.5.0 Released

After 21 months of sporadic work, I’ve finished the application for my «Thesis». Today I’m proud to announce the release of Blaapps Application Framework version 0.5.0.

Blaaps Logo for version 0.5.0

I’ve done lots of work transforming rudder Application Server, a previous project, into an Application Framework.

Blaapps Architecture

The Kernel of Blaapps is based on core Subsystems. Two of them are the most important:

  • Deployer
  • Messaging

The Deployer reads components called Modules, and loads them into memory. Modules are like plugins, hot plug-gable extensions to the application.

Messaging brings the infrastructure for the inter-module comunication.

Other features which are usually needed for Application development are packaged as Kernel Modules. In this version, two modules are included:

  • Remote
  • Persistence

Remote helps you to publish objects into a RMI Registry.

Persistence Is a JPA (Hibernate) wrapper.

As you can see, blaapps 0.5.0 is reinventing the wheel. There’s lots of plugin frameworks, and the EJB 3.0 standards helps you with persistence and remote objects. So why develop something like blaapps?

The first reason was that I wanted to learn how to do cool stuff, like Dependency Injection. Blaapps contains «only» 1800 lines of code, so it’s easier to learn from blaapps than from a real Application Server.

The second one is that I wanted something fast for my developments. Blaapps is very limited, but it starts in few seconds.

What’s next? Once I present my Thesis and became an official engineer, I’ll start with blaapps 0.6.0. There’s already a Milestone planning which will focus on making easier the building of GUIs.

Importing times in MySQL

One of the ways to import data into MySQL is using the LOAD DATA INFILE. It is a faster method than recovering from a dump, as it’s raw data instead of SQL sentences.

The import time depends on the table engine, for example, MyISAM can be 40 times faster than Innodb. Let’s benchmark this:

Preparation

I’m gonna make some benchmarking using MySQL 5.1.36 (64 bits MacOS X). I’ll need a big table, so I’ll take City from the World Database and create a huge table called «city_huge»:

CREATE TABLE city_huge LIKE CITY;

INSERT INTO city_huge 
    SELECT NULL, name, CountryCode, District, Population FROM city;
# Run this sentence 100 times,
# so city_huge table will be 100 times bigger than city.
# Tip: use a script, temporary table, stored procedure...
# or tell your monkey to do so.

SELECT COUNT(*) FROM city_huge;
#   +----------+
#   | COUNT(*) |
#   +----------+
#   |   407900 | 
#   +----------+

# Make a table data backup:
SELECT * FROM city_huge INTO OUTFILE 'city_huge.bak';

# Truncate table, so we'll start with an empty table.
TRUNCATE TABLE city_huge;

Direct Import

Let’s import the backup into the city_huge table, using MyISAM, InnoDB and MEMORY:

LOAD DATA INFILE 'city_huge.bak' INTO TABLE city_huge;
#   Query OK, ... (5.85 sec)
# So, that was using MyISAM.

# Let's empty the table and change the engine to InnoDB:
TRUNCATE TABLE city_huge;
ALTER TABLE city_huge ENGINE = InnoDB;
LOAD DATA INFILE 'city_huge.bak' INTO TABLE city_huge;
#   Query OK, ... (3 min 59.53 sec)

# With Memory:
TRUNCATE TABLE city_huge;
SET @@max_heap_size= 128 * 1024 * 1024;
ALTER TABLE city_huge ENGINE = MEMORY;
LOAD DATA INFILE 'city_huge.bak' INTO TABLE city_huge;
#   Query OK, ... (2.18 sec)
MyISAM 0:5.85
InnoDB 3:59.53
MEMORY 0:2.18

Wow, MyISAM is almost 40 times faster. And MEMORY is even faster.

Alter Table

Ok, InnoDB is a bit slow, but sometimes you can’t use another storage engine. In those cases, you could import in the other engine and then change the table engine to InnoDB.

That would look like this:

TRUNCATE TABLE city_huge;
ALTER TABLE city_huge ENGINE = MyISAM;
LOAD DATA INFILE 'city_huge.bak' INTO TABLE city_huge;
#   Query OK, ... (5.85 sec)
ALTER TABLE city_huge ENGINE = InnoDB;
#   Query OK, ... (4 min 11.24 sec)

Ooops, 4 min 17 sec is more than 3 min 59 sec.

Let’s try Memory:

TRUNCATE TABLE city_huge;
SET @@max_heap_size= 128 * 1024 * 1024;
ALTER TABLE city_huge ENGINE = MEMORY;
LOAD DATA INFILE 'city_huge.bak' INTO TABLE city_huge;
#   Query OK, ... (2.18 sec)
ALTER TABLE city_huge ENGINE = InnoDB;
# Query OK, ... (3 min 28.39 sec)

Yes, 3 min 31 sec is faster than 4 min. 30 seconds are around 10% faster.

Disclaimer

This benchmark is done using the default configuration, I’m sure that tuning InnoDB will improve the results. Also, I’m not the most accurate benchmarker, so I encourage you to do your own benchmarks.

This solution is not a silver bullet, MEMORY engine needs lots of memory. And this is NOT always the best approach, InnoDB should be fast by it’s own.

Anyway, its funny to discover those not so obvious behaviours :D.

Read Spanish Comments