title: MySQL is really unstable - Considering migration
body: <p>How can I make a more robust database server? I know this is a pretty general question but I'm getting all sort of errors and downtimes using MySQL with a simple service that does some selects and 2 inserts. Nothing complex, no JOINs...</p>
  
  <p>At first I got my host blocked from the DB server because of many connections, so I increased the max_used_connections parameter. And my client is actually closing the connections and handling the pool correctly.</p>
  
  <p>For some days it worked OK. Today I woke up and the MySQL server was down. Tried to restart it with <code>service mysql restart</code> and it failed. Tried to connect and error 1040: too many connections.
  So I couldn't even restart the server.</p>
  
  <p>I did <code>killall mysqld</code> and tried to start the server with <code>service mysql start</code>. Service wouldn't start. Run <code>su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe &gt; /dev/null 2&gt;&amp;1 &amp;"</code> and the server finally started.</p>
  
  <p>I also increased max_connections limit because the server would just die after some seconds when starting it today.</p>
  
  <p>Then one table was corrupt <code>ERROR 144 (HY000): Table '&lt;table_name&gt;' is marked as crashed and last (automatic?) repair failed</code></p>
  
  <p>Tried to <code>REPAIR &lt;table_name&gt;</code> but after some time the server died again <code>ERROR 2006 (HY000): MySQL server has gone away</code>. Tried this same process (killall up to here) about 3 times, everytime the server died.</p>
  
  <p>Now I'm running <code>REPAIR &lt;table_name&gt; QUICK</code> and the server seems not to be dying, but it's taking a really long time to fix a 200k row table.</p>
  
  <p>By the way, I only have two tables, one with 200k rows and another with 11M rows. I peak about 2000 concurrent users, which result in about 100 queries per second max.</p>
  
  <p>Is it normal that MySQL crashes this easy? Should I migrate to other more scalable databases like Cassandra? I actually prefer a relational database for my case (table results has a request_id, FK of a requests table that has a key_id FK of a keys table), but wouldn't mind losing the relational benefits for an actually good uptime.</p>