List:General Discussion« Previous MessageNext Message »
From:Joseph Bueno Date:March 19 2003 5:20pm
Subject:Re: Process Limit on Linux ?
View as plain text  
Hi,

You may get a signal 11 because mysqld process is running out of
virtual memory (instead of physical memory).
If you want to run 1500 simultaneous connections, you have to be very
careful on how mysqld allocates its memory:

Since you are on a 32bits system, a process is limited to 4Gb.
On Linux, these 4Gb are split in 3Gb user space/1Gb kernel space
and user space is split in 1Gb code segment/2Gb data segment.
So you have "only" 2Gb for all mysqld data.
You can get more info on how mysqld allocates memory at:
http://www.mysql.com/doc/en/Memory_use.html
and http://www.mysql.com/doc/en/InnoDB_start.html if you
have InnoDB.

As a rule of thumb,
execute 'show variables',
evaluate:
      key_buffer_size
    + innodb_additional_mem_pool_size
    + innodb_buffer_pool_size
    + innodb_log_buffer_size
    = global_data_size

      thread_stack
    + 2 * net_buffer_length (1 connection buffer, 1 result buffer)
    + record_buffer OR record_rnd_buffer (depends on table access method)
    + sort_buffer_size (if resultset needs to be sorted)
    = per_thread_data_size

and make sure that:
global_data_size + per_thread_data_size * nb_of_connections < 2Gb

Although I have never run mysql with more than ~600 connections,
I have used this formula (a simplified version since I don't use
InnoDB) to allocate a key_buffer as big as possible and make sure
that I won't run out of memory.

Hope this helps,
Joseph Bueno

Philipp wrote:
> Hi Dan,
> 
> 
> i just talked about openmosix because i read about
> shared memory segments. my only desire is to make mysql
> able to spawn 1000-1500 connections and *not* to tell
> my client "cant create new thread, perhaps out of memory"
> while 1.5 GB of RAM is only used for caching. Is that really
> possible that mysql is not able to handle this amount of connections ?
> 
> My best Regards,
> Philipp
> 
> 
> On Wed, 19 Mar 2003 10:01:38 -0600
> Dan Nelson <dnelson@stripped> wrote:
> 
> 
>>In the last episode (Mar 19), Philipp said:
>>
>>>thank you for your answer. While i was reading about clustering some
>>>weeks ago i read the openmosix FAQ claiming that openmosix would not
>>>work with apache, because apache was using shared memory to
>>>communicate with its threads, and i always thought mysql is designed
>>>the same way. Please someone correct me if i am wrong.
>>
>>SYSV shared memory (shm*) is a block of memory that one process
>>creates, and depending on the access flags, multiple processes can
>>attach to and see each other's changes.
>>
>>Threads use shared memory by definition, because a threaded application
>>is still one process.  No SYSV shm tricks are needed.
>>
>>Openmosix won't be able to balance mysql threads, because even if it
>>were possible to synchronize shared memory between machines with Mosix,
>>synching thread mutexes would be horrendously slow.  Better to just get
>>a multi-CPU box.
>>
>>-- 
>>	Dan Nelson
>>	dnelson@stripped
>>
> 
> 
> 


Thread
Process Limit on Linux ?Philipp16 Mar
  • Re: Process Limit on Linux ?walt17 Mar
  • Re: Process Limit on Linux ?Philipp18 Mar
    • Re: Process Limit on Linux ?Joseph Bueno19 Mar
      • Re: Process Limit on Linux ?Philipp19 Mar
        • Re: Process Limit on Linux ?Dan Nelson19 Mar
          • Re: Process Limit on Linux ?Philipp19 Mar
            • Re: Process Limit on Linux ?Joseph Bueno19 Mar
            • Re: Process Limit on Linux ?Dan Nelson19 Mar
              • Re: Process Limit on Linux ?walt19 Mar
  • Re: Process Limit on Linux ?Philipp18 Mar