Raf Geusens writes:
 > Hi,
 > 
 > I know I've allready posted this question but it's rather important for my 
 > final work. I'll add some extra information at the bottom.
 > I've got a question 'bout the number of number of writes a MySQLserver can 
 > handle in a second. I've written a program which contains the following 
 > code:
 > 
 > typedef struct {
 > MYSQL * connection;                                                          
 >     char  * database;
 > } con;
 > 
 > int resolvequery(char * vraag, MYSQL_RES& toReturn, int& affected, int       
 >     control) {
 > MYSQL_RES * result;
 > MYSQL_ROW row;
 > int state,counter;                                                           
 >     char * query;
 > char * db;
 > MYSQL * connect;
 > int * temporal;
 > 
 >   connect = standardcon.connection;
 >   db = standardcon.database;
 > 
 > state = mysql_real_query(connect, vraag, 1024);
 > if (state != 0) {                                                            
 >      printf(mysql_error(connect));
 >   return 1;
 > }
 > if((strncmp(vraag,"SEL",3)==0)||(strncmp(vraag,"SHO",3)==0)                  
 >      ||(strncmp(vraag,"DES",3)==0))
 > {
 >   result = mysql_store_result(connect);
 >   affected = mysql_num_rows(result);                                         
 >       toReturn = *result;
 > }
 > else
 >   affected = 0;
 > return 0;
 > }
 > 
 > And when I call this procedure 50 times/second (from one client)
 > or 100 times/second (two clients at the same time) it stores all the data 
 > without generating an error, but immediatly when I start a third client it 
 > crashes with the usual segmentation fault. In case you need it, the calls 
 > are made from this function:
 > 
 > CORBA::Short i_DBM_impl::storeData(const DINA::t_Table& table,
 > const char * e) throw(CORBA::SystemException)
 > {                                                                            
 >      int state;
 > char * mission;
 > MYSQL_RES temp;
 > mission = (char *) malloc(256 * sizeof(char));                               
 >     sprintf(mission, "INSERT DELAYED INTO %s VALUES 
 > ('%s',CURRENT_TIMESTAMP())",
 >   (char *) table.name, e);
 > cout << mission << endl;
 > if (resolvequery(mission,temp,state,0)==0)                                   
 >      return 1;
 > else
 >   return 0;                                                                  
 >     }
 > 
 > So is it possible that some buffer is full or something when more than 100 
 > inserts in second are requested?? What can I do to adjust the performance or 
 > did I make other mistakes?? I'm using mysql  Ver 9.38 Distrib 3.22.32, for 
 > pc-linux-gnu (i586) on Debian Linux machine.
 > Please can you also mail to me ([EMAIL PROTECTED]) and not only directly 
 > to the list (I'm receiving the index-version and else I've to wait too long 
 > :-)
 > 
 > Extra info:
 > 
 > SHOW STATUS:
 > +--------------------------+--------+
 > | Variable_name            | Value  |
 > +--------------------------+--------+
 > | Aborted_clients          | 0      |
 > | Aborted_connects         | 0      |
 > | Created_tmp_tables       | 0      |
 > | Delayed_insert_threads   | 0      |
 > | Delayed_writes           | 10101  |
 > | Delayed_errors           | 60     |
 > | Flush_commands           | 1      |
 > | Handler_delete           | 0      |
 > | Handler_read_first       | 0      |
 > | Handler_read_key         | 68198  |
 > | Handler_read_next        | 1332   |
 > | Handler_read_rnd         | 788092 |
 > | Handler_update           | 68194  |
 > | Handler_write            | 107755 |
 > | Key_blocks_used          | 3466   |
 > | Key_read_requests        | 354147 |
 > | Key_reads                | 1      |
 > | Key_write_requests       | 114449 |
 > | Key_writes               | 114426 |
 > | Max_used_connections     | 3      |
 > | Not_flushed_key_blocks   | 0      |
 > | Not_flushed_delayed_rows | 0      |
 > | Open_tables              | 2      |
 > | Open_files               | 4      |
 > | Open_streams             | 1      |
 > | Opened_tables            | 91     |
 > | Questions                | 449077 |
 > | Running_threads          | 1      |
 > | Slow_queries             | 0      |
 > | Uptime                   | 331347 |
 > +--------------------------+--------+
 > 
 > and SHOW VARIABLES:
 > 
 > 
 > +----------------------------+-----------------------------+
 > | Variable_name              | Value                       |
 > +----------------------------+-----------------------------+
 > | back_log                   | 5                           |
 > | connect_timeout            | 5                           |
 > | basedir                    | /usr/                       |
 > | datadir                    | /var/lib/mysql/             |
 > | delayed_insert_limit       | 100                         |
 > | delayed_insert_timeout     | 300                         |
 > | delayed_queue_size         | 1000                        |
 > | join_buffer                | 131072                      |
 > | flush_time                 | 0                           |
 > | key_buffer                 | 16773120                    |
 > | language                   | /usr/share/mysql/english/   |
 > | log                        | ON                          |
 > | log_update                 | OFF                         |
 > | long_query_time            | 10                          |
 > | low_priority_updates       | OFF                         |
 > | max_allowed_packet         | 1047552                     |
 > | max_connections            | 100                         |
 > | max_connect_errors         | 10                          |
 > | max_delayed_insert_threads | 20                          |
 > | max_join_size              | 4294967295                  |
 > | max_sort_length            | 1024                        |
 > | max_write_lock_count       | 4294967295                  |
 > | net_buffer_length          | 16384                       |
 > | pid_file                   | /var/run/mysqld/mysqld.pid  |
 > | port                       | 3306                        |
 > | protocol_version           | 10                          |
 > | record_buffer              | 131072                      |
 > | skip_locking               | ON                          |
 > | skip_networking            | OFF                         |
 > | socket                     | /var/run/mysqld/mysqld.sock |
 > | sort_buffer                | 2097144                     |
 > | table_cache                | 64                          |
 > | thread_stack               | 131072                      |
 > | tmp_table_size             | 1048576                     |
 > | tmpdir                     | /tmp/                       |
 > | version                    | 3.22.32-log                 |
 > | wait_timeout               | 28800                       |
 > +----------------------------+-----------------------------+
 > 
 > Greetings,
 > Raf
 > _________________________________________________________________________
 > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
 > 
 > 
 > 

Hi!

First, you do not call mysql_free_result and second, you use functions
that are meant for queries that return result sets, which INSERT is
not.


Regards,

Sinisa

      ____  __     _____   _____  ___     ==  MySQL AB
     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sinisa Milivojevic
    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:[EMAIL PROTECTED]
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Larnaca, Cyprus
  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____
  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
             /*/             \*\                Developers Team

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to