Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Can Percona Server have thread memory usage statistics?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lixun Peng  
View profile  
 More options Apr 26 2012, 11:57 am
From: Lixun Peng <pengli...@gmail.com>
Date: Thu, 26 Apr 2012 23:57:36 +0800
Local: Thurs, Apr 26 2012 11:57 am
Subject: Can Percona Server have thread memory usage statistics?

Hi Guys,

I always found my MySQL use many memory, even though Buffer Pool is small.
So I think Server used many memory.
I developed a demo patch (see picture), it can display how many memory used
of threads.
Expect this, I think how many sort_buffer/join_buffer/net_buffer memory
used of threads are also need display, it will let DBAs know the memory
cost detail.

Do you think this function is very useful?

--
Best Wishes

Lixun Peng (P.Linux)

Mobile Phone:
+86 18658156856 (Hangzhou)
Gtalk: penglixun(at)gmail.com
Twitter: http://www.twitter.com/plinux
Blog: http://www.penglixun.com

  1.jpg
502K Download

  5.6_thread_mem_usage.patch
4K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lixun Peng  
View profile  
 More options Apr 26 2012, 11:58 am
From: Lixun Peng <pengli...@gmail.com>
Date: Thu, 26 Apr 2012 23:58:37 +0800
Local: Thurs, Apr 26 2012 11:58 am
Subject: Re: Can Percona Server have thread memory usage statistics?

by the way, the demo patch is based on MySQL 5.6.6-labs.

在 2012年4月26日 下午11:57,Lixun Peng <pengli...@gmail.com>写道:

--
Best Wishes

Lixun Peng (P.Linux)

Mobile Phone:
+86 18658156856 (Hangzhou)
Gtalk: penglixun(at)gmail.com
Twitter: http://www.twitter.com/plinux
Blog: http://www.penglixun.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurynas Biveinis  
View profile  
 More options Apr 26 2012, 11:57 pm
From: Laurynas Biveinis <laurynas.bivei...@percona.com>
Date: Fri, 27 Apr 2012 06:57:09 +0300
Local: Thurs, Apr 26 2012 11:57 pm
Subject: Re: Can Percona Server have thread memory usage statistics?
Lixun -

The feature seems to be interesting at least to me personally. The
patch is based on 5.6 however and currently we don't have a code base
to integrate to. Feel free to open a wishlist bug in Launchpad for
Percona Server with the patch attached.

Thank you,
Laurynas

--
Laurynas
www.percona.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Bergen  
View profile  
 More options Apr 26 2012, 11:59 pm
From: Eric Bergen <eric.ber...@gmail.com>
Date: Thu, 26 Apr 2012 20:59:18 -0700
Local: Thurs, Apr 26 2012 11:59 pm
Subject: Re: Can Percona Server have thread memory usage statistics?
That is very cool. Do you have a way to roll up all the memory usage
and track a high water mark?

On Thu, Apr 26, 2012 at 8:57 PM, Laurynas Biveinis

--
Eric Bergen
eric.ber...@gmail.com
http://www.ebergen.net

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ser...@pisem.net  
View profile  
 More options Apr 27 2012, 4:37 am
From: ser...@pisem.net
Date: Fri, 27 Apr 2012 10:37:23 +0200
Local: Fri, Apr 27 2012 4:37 am
Subject: Re: Can Percona Server have thread memory usage statistics?
Hi, Laurynas!

On Apr 27, Laurynas Biveinis wrote:

> Lixun -

> The feature seems to be interesting at least to me personally. The
> patch is based on 5.6 however and currently we don't have a code base
> to integrate to. Feel free to open a wishlist bug in Launchpad for
> Percona Server with the patch attached.

The patch is small and can be trivially applied to any version, even to
5.1.

But how portable this malloc_usable_size() is?
I've never heard about it before. It doesn't have a manpage (on a couple
of linux boxes that I've tried, although google shows quite a few
manpages for it). But google also shows discussion mails about removing
malloc_usable_size() from somewhere and "don't use" elsewhere.

Regards,
Sergei


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lixun Peng  
View profile  
 More options Apr 27 2012, 7:22 am
From: Lixun Peng <pengli...@gmail.com>
Date: Fri, 27 Apr 2012 19:22:59 +0800
Local: Fri, Apr 27 2012 7:22 am
Subject: Re: Can Percona Server have thread memory usage statistics?

Hi Sergei,

Because I don't know how to get a pointor own how many memory, I remember
have a function "_msize" at Windows, then I found the  “malloc_usable_size” at
Linux, the usage  like “_msize”.
If have any other simple way to know a pointor own how many memory, I will
change this code.

Thanks,
Lixun

2012/4/27 <ser...@pisem.net>

--
Best Wishes

Lixun Peng (P.Linux)

Mobile Phone:
+86 18658156856 (Hangzhou)
Gtalk: penglixun(at)gmail.com
Twitter: http://www.twitter.com/plinux
Blog: http://www.penglixun.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ser...@pisem.net  
View profile  
 More options Apr 27 2012, 8:31 am
From: ser...@pisem.net
Date: Fri, 27 Apr 2012 14:31:51 +0200
Local: Fri, Apr 27 2012 8:31 am
Subject: Re: Can Percona Server have thread memory usage statistics?
Hi, Lixun!

On Apr 27, Lixun Peng wrote:

> Hi Sergei,

> Because I don't know how to get a pointor own how many memory, I
> remember have a function "_msize" at Windows, then I found the
> “malloc_usable_size” at Linux, the usage  like “_msize”.
> If have any other simple way to know a pointor own how many memory, I
> will change this code.

I don't :)

I've only found malloc_usable_size and _msize - and only after
seeing your patch.

We (*) certainly want to track memory usage per connection and globally
in the server. I thought that the only way of doing it would be to store
the size directly in the allocated block.

But now I'll check whether malloc_usable_size/_msize are good enough.
So, I'm really interested to know how portable they are.
FreeBSD ? Mac OS X? Solaris?

Regards,
Sergei

(*) We means MariaDB, not Percona :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lixun Peng  
View profile  
 More options Apr 27 2012, 8:58 am
From: Lixun Peng <pengli...@gmail.com>
Date: Fri, 27 Apr 2012 20:58:41 +0800
Local: Fri, Apr 27 2012 8:58 am
Subject: Re: Can Percona Server have thread memory usage statistics?

Hi Sergei,

I only have Linux and Mac OS X environment.
I test on GCC 4.1 and GCC 4.2, GCC 4.1 have  malloc_usable_size   and GCC
4.3 have  malloc_size.
Which  malloc_usable_size can run on Linux, and  malloc_size can run on Mac
OS X.
I think we can use macro  to select  malloc_usable_size or  malloc_size.

Before I found  malloc_usable_size/ malloc_size, I tested a method that by
allocate space to store size.
Like "point=malloc(size+sizeof(size_t)); memcpy(point, &size,
sizeof(size_t)); return print+sizeof(size_t);" and "memcpy(&size, point,
sizeof(size_t)); free(point-sizeof(size_t))",
but it run test case fail, so I give up this way.

Because all of my OS are Linux, so I use "malloc_usable_size/ malloc_size "
way.
I think you can try the way above. I have no enough time to DEBUG, because
I'm a DBA, I only can try above way if I have enough  time.

2012/4/27 <ser...@pisem.net>

--
Best Wishes

Lixun Peng (P.Linux)

Mobile Phone:
+86 18658156856 (Hangzhou)
Gtalk: penglixun(at)gmail.com
Twitter: http://www.twitter.com/plinux
Blog: http://www.penglixun.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ser...@pisem.net  
View profile  
 More options Apr 27 2012, 9:20 am
From: ser...@pisem.net
Date: Fri, 27 Apr 2012 15:20:41 +0200
Local: Fri, Apr 27 2012 9:20 am
Subject: Re: Can Percona Server have thread memory usage statistics?
Hi, Lixun!

On Apr 27, Lixun Peng wrote:

> Hi Sergei,

> I only have Linux and Mac OS X environment.  I test on GCC 4.1 and GCC
> 4.2, GCC 4.1 have  malloc_usable_size   and GCC 4.3 have  malloc_size.
> Which  malloc_usable_size can run on Linux, and  malloc_size can run
> on Mac OS X.
> I think we can use macro  to select  malloc_usable_size or  malloc_size.

Certainly.

> Before I found  malloc_usable_size/ malloc_size, I tested a method
> that by allocate space to store size.
> Like "point=malloc(size+sizeof(size_t)); memcpy(point, &size,
> sizeof(size_t)); return print+sizeof(size_t);" and "memcpy(&size, point,
> sizeof(size_t)); free(point-sizeof(size_t))",
> but it run test case fail, so I give up this way.

Yes, that's what I meant. I wonder why the tests fail for you.
But never mind, it's not really important, if malloc_usable_size is
sufficient.

> Because all of my OS are Linux, so I use "malloc_usable_size/
> malloc_size " way.
> I think you can try the way above. I have no enough time to DEBUG,
> because I'm a DBA, I only can try above way if I have enough  time.

Well, I think you've done more than enough already :)
I'll see if we can get it into MariaDB.
But I don't know what are Percona's criteria for including your patch.

Regards,
Sergei


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lixun Peng  
View profile  
 More options Apr 27 2012, 10:04 pm
From: Lixun Peng <pengli...@gmail.com>
Date: Sat, 28 Apr 2012 10:04:38 +0800
Local: Fri, Apr 27 2012 10:04 pm
Subject: Re: Can Percona Server have thread memory usage statistics?

Hi Sergei,

I found this macro can run on most of OS.

#if defined(__APPLE__)
#define _msize(p)      malloc_size(p)
#elif defined(__sun)
#define _msize(p)      (*((size_t*)(p)-1))
#elif !defined(_WIN32)
#define _msize(p)      malloc_usable_size(p)
#endif

I test on OSX/Linux 2.6/Linux 3.0/FreeBSD/Solaris, use "_msize" instead of
"malloc_usable_size", all OS can run well.

I update the patch yesterday, add monitor function on realloc, and only
init callback function once.

2012/4/27 <ser...@pisem.net>

--
Best Wishes

Lixun Peng (P.Linux)

Mobile Phone:
+86 18658156856 (Hangzhou)
Gtalk: penglixun(at)gmail.com
Twitter: http://www.twitter.com/plinux
Blog: http://www.penglixun.com

  5.6_thread_mem_usage.patch
7K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vadim Tkachenko  
View profile  
 More options Apr 27 2012, 11:44 pm
From: Vadim Tkachenko <va...@percona.com>
Date: Fri, 27 Apr 2012 20:44:35 -0700
Local: Fri, Apr 27 2012 11:44 pm
Subject: Re: Can Percona Server have thread memory usage statistics?
Lixun,

It definitely looks interesting.
Most interesting is this is a short patch.

We will take look if we can include it in Percona Server 5.5, or it is
going to be 5.6

Thanks,
Vadim

--
Vadim Tkachenko, CTO, Percona Inc.
Phone +1-925-400-7377,  Skype: vadimtk153
Schedule meeting: http://tungle.me/VadimTkachenko

Looking for Replication with Data Consistency?
Try Percona XtraDB Cluster!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lixun Peng  
View profile  
 More options Apr 28 2012, 5:01 am
From: Lixun Peng <pengli...@gmail.com>
Date: Sat, 28 Apr 2012 17:01:08 +0800
Local: Sat, Apr 28 2012 5:01 am
Subject: Re: Can Percona Server have thread memory usage statistics?

Hi Vadim,

I have tried to merge to Percona 5.5.22-25.2, it's ok.
it test by myself, on OSX/Linux.

2012/4/28 Vadim Tkachenko <va...@percona.com>

--
Best Wishes

Lixun Peng (P.Linux)

Mobile Phone:
+86 18658156856 (Hangzhou)
Gtalk: penglixun(at)gmail.com
Twitter: http://www.twitter.com/plinux
Blog: http://www.penglixun.com

  5.5_thread_mem_usage.patch
7K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurynas Biveinis  
View profile  
 More options Apr 29 2012, 11:48 pm
From: Laurynas Biveinis <laurynas.bivei...@percona.com>
Date: Mon, 30 Apr 2012 06:48:17 +0300
Local: Sun, Apr 29 2012 11:48 pm
Subject: Re: Can Percona Server have thread memory usage statistics?
Lixun -

Thanks. I have created a request at
https://bugs.launchpad.net/percona-server/+bug/991651
to track this.

--
Laurynas
www.percona.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »