How to slim MySQL?

How to slim MySQL?

am 05.07.2010 16:59:39 von nima

--0015174be278978734048aa52fe2
Content-Type: text/plain; charset=UTF-8

Hi folks,
I'd like to install MySQL on an embedded system. It's a powerful x86-based
computer with the only limitation of having a small-size flash ROM as its
secondary storage.
I tried installing MySQL from source which resulted in occupying 140 MB of
disk space, while the maximum amount of flash memory I'm permitted to use is
about 20-30 MB. So I'm wondering how to go about slimming MySQL down to the
bare minimum. Following is the list of directories at the root of the
installation directory:
* bin/
* include/
* lib/
* libexec/
* mysql-test/
* share/
* sql-bench/

I think removing the 'include', 'mysql-test' and 'sql-bench' directories may
be a good start, but I'm still far away from having a tiny little mysql!

BTW, I tried MySQL Embedded, but it seems that it doesn't meet our needs.

Any help would be highly appreciated :)

*-- Nima Mohammadi*

--0015174be278978734048aa52fe2--

Re: How to slim MySQL?

am 05.07.2010 17:56:45 von Rob Wultsch

On Mon, Jul 5, 2010 at 7:59 AM, Nima wrote:
> Hi folks,
> I'd like to install MySQL on an embedded system. It's a powerful x86-based
> computer with the only limitation of having a small-size flash ROM as its
> secondary storage.
> I tried installing MySQL from source which resulted in occupying 140 MB of
> disk space, while the maximum amount of flash memory I'm permitted to use is
> about 20-30 MB. So I'm wondering how to go about slimming MySQL down to the
> bare minimum. Following is the list of directories at the root of the
> installation directory:
> * bin/
> * include/
> * lib/
> * libexec/
> * mysql-test/
> * share/
> * sql-bench/
>
> I think removing the 'include', 'mysql-test' and 'sql-bench' directories may
> be a good start, but I'm still far away from having a tiny little mysql!
>
> BTW, I tried MySQL Embedded, but it seems that it doesn't meet our needs.
>
> Any help would be highly appreciated :)
>
> *-- Nima Mohammadi*
>

Have you considered SQLite?

You probably want to compile your own version of MySQL. You probably
want to remove debugging symbols* (which have been present since the
mid 5.0 series, iirc), and any engines/character sets/etc you don't
need.

*Alternatively you can run the strip command.

--
Rob Wultsch
wultsch@gmail.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: How to slim MySQL?

am 05.07.2010 19:07:22 von Nima Mohammadi

--0015174c115a566bf7048aa6f8ba
Content-Type: text/plain; charset=UTF-8

On Mon, Jul 5, 2010 at 8:26 PM, Rob Wultsch wrote:

>
> Have you considered SQLite?
>
> You probably want to compile your own version of MySQL. You probably
> want to remove debugging symbols* (which have been present since the
> mid 5.0 series, iirc), and any engines/character sets/etc you don't
> need.
>
> *Alternatively you can run the strip command.
>
> --
> Rob Wultsch
> wultsch@gmail.com
>

Well, I'm not in charge of deciding which RDBMS to use and the MySQL is
needed for a program which has already been written. So it seems that we
have no choice but to stick with MySQL.
I guess for removing debug symbols I need to add the "--without-debug"
option to the ./configure command. I think using these options would also be
helpful:

- --without-man
- --without-docs
- --without-ipv6
- --disable-largefile

I'm not sure which engine we're going to use, so I'll have to defer this to
another time.
Is there any other work I could do to strip MySQL?

*-- Nima Mohammadi*

--0015174c115a566bf7048aa6f8ba--

Re: How to slim MySQL?

am 05.07.2010 19:41:42 von Rob Wultsch

On Mon, Jul 5, 2010 at 10:07 AM, Nima Mohammadi wrote:
> On Mon, Jul 5, 2010 at 8:26 PM, Rob Wultsch wrote:
>
>>
>> Have you considered SQLite?
>>
>> You probably want to compile your own version of MySQL. You probably
>> want to remove debugging symbols* (which have been present since the
>> mid 5.0 series, iirc), and any engines/character sets/etc you don't
>> need.
>>
>> *Alternatively you can run the strip command.
>>
>> --
>> Rob Wultsch
>> wultsch@gmail.com
>>
>
> Well, I'm not in charge of deciding which RDBMS to use and the MySQL is
> needed for a program which has already been written. So it seems that we
> have no choice but to stick with MySQL.
> I guess for removing debug symbols I need to add the "--without-debug"
> option to the ./configure command. I think using these options would also=
be
> helpful:
>
> =A0 - --without-man
> =A0 - --without-docs
> =A0 - --without-ipv6
> =A0 - --disable-largefile
>
> I'm not sure which engine we're going to use, so I'll have to defer this =
to
> another time.
> Is there any other work I could do to strip MySQL?
>
> *-- Nima Mohammadi*
>

This is not a topic I have worked with previously. I image this may
be a good topic to bring to a consulting company (specifically Percona
and Open Query might work well) if you are unable to meet your size
goals.



--=20
Rob Wultsch
wultsch@gmail.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: How to slim MySQL?

am 05.07.2010 19:53:33 von Nima Mohammadi

--000e0cd136f6871d8c048aa79dd1
Content-Type: text/plain; charset=UTF-8

On Mon, Jul 5, 2010 at 10:11 PM, Rob Wultsch wrote:


> This is not a topic I have worked with previously. I image this may
> be a good topic to bring to a consulting company (specifically Percona
> and Open Query might work well) if you are unable to meet your size
> goals.
>
>
>
> --
> Rob Wultsch
> wultsch@gmail.com
>

As a low budget, semi-student project, I don't see that as an option!

*-- Nima Mohammadi*

--000e0cd136f6871d8c048aa79dd1--

Re: How to slim MySQL?

am 05.07.2010 22:24:58 von Michael Dykman

As you are building from source, whats pre-compile configuration
options are you using? That will have everything to do with the size
of your resulting binaries.

- michael dykman


On Mon, Jul 5, 2010 at 1:53 PM, Nima Mohammadi wrote:
> On Mon, Jul 5, 2010 at 10:11 PM, Rob Wultsch wrote:
>
>
>> This is not a topic I have worked with previously. =A0I image this may
>> be a good topic to bring to a consulting company (specifically Percona
>> and Open Query might work well) if you are unable to meet your size
>> goals.
>>
>>
>>
>> --
>> Rob Wultsch
>> wultsch@gmail.com
>>
>
> As a low budget, semi-student project, I don't see that as an option!
>
> *-- Nima Mohammadi*
>



--=20
- michael dykman
- mdykman@gmail.com

May the Source be with you.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: How to slim MySQL?

am 05.07.2010 22:40:36 von Michael Dykman

Go through that list of options and exclude anything you don't want or
need. It is a very long list.

- md

On Mon, Jul 5, 2010 at 4:39 PM, Nima Mohammadi wrote:
>
> On Tue, Jul 6, 2010 at 12:54 AM, Michael Dykman wrote=
:
>>
>> As you are building from source, whats pre-compile configuration
>> options are you using? =A0That will have everything to do with the size
>> of your resulting binaries.
>>
>> =A0- michael dykman
>>
>
> ./configure --prefix=3D/home/nima/mysql/ --without-docs --without-debug
> --without-man --disable-ipv6 --disable-largefile
>
>
> -- Nima Mohammadi
>



--=20
- michael dykman
- mdykman@gmail.com

May the Source be with you.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: How to slim MySQL?

am 06.07.2010 11:30:01 von Joerg Bruehe

Hi!


Nima Mohammadi wrote:
> On Mon, Jul 5, 2010 at 8:26 PM, Rob Wultsch wro=
te:
>=20
>> [[...]]
>>
>> You probably want to compile your own version of MySQL. You probab=
ly
>> want to remove debugging symbols* (which have been present since t=
he
>> mid 5.0 series, iirc), and any engines/character sets/etc you don'=
t
>> need.
>>
>> *Alternatively you can run the strip command.
>>
>> --
>> Rob Wultsch
>> wultsch@gmail.com
>>
>=20
> [[...]]
> I guess for removing debug symbols I need to add the "--without-deb=
ug"
> option to the ./configure command. I think using these options woul=
d also be
> helpful:
>=20
> - --without-man
> - --without-docs

This will affect the package size, but not the individual binary.

> - --without-ipv6
> - --disable-largefile

"largefile" shouldn't have a big effect on size, but in a tiny embedd=
ed
system you probably really don't need it.

>=20
> I'm not sure which engine we're going to use, so I'll have to defer=
this to
> another time.

The engine will be quite important, stripping all engines you don't n=
eed
will have the largest effect on size.

> Is there any other work I could do to strip MySQL?

Check the character sets you configure, get rid of those you don't ne=
ed.

You might look into compiler options optimizing for space rather than
for speed, but I hope you are not that much limited by your system.

If you want to run client/server as separate binaries, you can use
"--without-embedded". However, I guess linking the server part to the
application will have a big effect on space requirements, so you real=
ly
should look into that.

Are you using version 5.1 or 5.5 ?


Jörg

--=20
Joerg Bruehe, MySQL Build Team, Joerg.Bruehe@Sun.COM
ORACLE Deutschland B.V. & Co. KG, Komturstrasse 18a, D-12099 Berl=
in
Geschaeftsfuehrer: Juergen Kunz, Marcel v.d. Molen, Alexander v.d. Ve=
n
Amtsgericht Muenchen: HRA 95603


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: How to slim MySQL?

am 06.07.2010 16:40:22 von mos

Roam,
Why are you installing a client server database on an embedded
system? There are better databases for this task. In the past I've been
able to squeeze a Windows application and an SQL database so it could run
directly off of a floppy disk (remember those?). But it wasn't client
server. :) It seems to me you are trying to fit an elephant into a phone
booth. Just don't expect it to sit up and dance.

BTW, where are the MySQL temp files going to go? Like the ones used
for sorting the table? Also are you going to have crash recovery in case
the machine gets accidentally powered off and damages the database?

Mike

At 09:59 AM 7/5/2010, you wrote:
>Hi folks,
>I'd like to install MySQL on an embedded system. It's a powerful x86-based
>computer with the only limitation of having a small-size flash ROM as its
>secondary storage.
>I tried installing MySQL from source which resulted in occupying 140 MB of
>disk space, while the maximum amount of flash memory I'm permitted to use is
>about 20-30 MB. So I'm wondering how to go about slimming MySQL down to the
>bare minimum. Following is the list of directories at the root of the
>installation directory:
>* bin/
>* include/
>* lib/
>* libexec/
>* mysql-test/
>* share/
>* sql-bench/
>
>I think removing the 'include', 'mysql-test' and 'sql-bench' directories may
>be a good start, but I'm still far away from having a tiny little mysql!
>
>BTW, I tried MySQL Embedded, but it seems that it doesn't meet our needs.
>
>Any help would be highly appreciated :)
>
>*-- Nima Mohammadi*


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: How to slim MySQL?

am 06.07.2010 17:58:18 von Nima Mohammadi

--0015174c3c86311974048aba1ff1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tue, Jul 6, 2010 at 2:00 PM, Joerg Bruehe wrote:

> Hi!
>
>
> Nima Mohammadi wrote:
> > On Mon, Jul 5, 2010 at 8:26 PM, Rob Wultsch wrote:
> >
> >> [[...]]
> >>
> >> You probably want to compile your own version of MySQL. You probably
> >> want to remove debugging symbols* (which have been present since the
> >> mid 5.0 series, iirc), and any engines/character sets/etc you don't
> >> need.
> >>
> >> *Alternatively you can run the strip command.
> >>
> >> --
> >> Rob Wultsch
> >> wultsch@gmail.com
> >>
> >
> > [[...]]
> > I guess for removing debug symbols I need to add the "--without-debug"
> > option to the ./configure command. I think using these options would al=
so
> be
> > helpful:
> >
> > - --without-man
> > - --without-docs
>
> This will affect the package size, but not the individual binary.
>
> > - --without-ipv6
> > - --disable-largefile
>
> "largefile" shouldn't have a big effect on size, but in a tiny embedded
> system you probably really don't need it.
>
> >
> > I'm not sure which engine we're going to use, so I'll have to defer thi=
s
> to
> > another time.
>
> The engine will be quite important, stripping all engines you don't need
> will have the largest effect on size.
>
> > Is there any other work I could do to strip MySQL?
>
> Check the character sets you configure, get rid of those you don't need.
>
> You might look into compiler options optimizing for space rather than
> for speed, but I hope you are not that much limited by your system.
>
> If you want to run client/server as separate binaries, you can use
> "--without-embedded". However, I guess linking the server part to the
> application will have a big effect on space requirements, so you really
> should look into that.
>
> Are you using version 5.1 or 5.5 ?
>
>
> Jörg
>
> --
> Joerg Bruehe, MySQL Build Team, Joerg.Bruehe@Sun.COM
> ORACLE Deutschland B.V. & Co. KG, Komturstrasse 18a, D-12099 Berlin
> Geschaeftsfuehrer: Juergen Kunz, Marcel v.d. Molen, Alexander v.d. Ven
> Amtsgericht Muenchen: HRA 95603
>
>
Thanks for your help. Your answer was quite helpful :)
I'm not sure what "--without-embedded" option does but I'll certainly
consider that.
We are using MySQL 5.1.

-- Nima Mohammadi

--0015174c3c86311974048aba1ff1--

Re: How to slim MySQL?

am 06.07.2010 17:59:49 von Nima Mohammadi

--0015174c3f449f007d048aba247b
Content-Type: text/plain; charset=UTF-8

On Tue, Jul 6, 2010 at 7:10 PM, mos wrote:

> Roam,
> Why are you installing a client server database on an embedded
> system? There are better databases for this task. In the past I've been able
> to squeeze a Windows application and an SQL database so it could run
> directly off of a floppy disk (remember those?). But it wasn't client
> server. :) It seems to me you are trying to fit an elephant into a phone
> booth. Just don't expect it to sit up and dance.
>
> BTW, where are the MySQL temp files going to go? Like the ones used for
> sorting the table? Also are you going to have crash recovery in case the
> machine gets accidentally powered off and damages the database?
>
> Mike
>
>
As I previously said, deciding which RBMS to use is not up to me. Actually I
myself suggested SQLite, but the system has already been designed and it's
not possible to change the plans.
Our case doesn't fit into your analogy (elephant and phone booth). The
system has a powerful processor, 2GB of RAM and broadcasts video over the
network. But the operating system resides on a flash memory. The client
program, used to receive the stream, connects to the MySQL server to do some
ACL and authentication stuff. There are some stored procedure in the DB
which does the job.
The purpose of using a flash memory and a read-only ramfs was to conqueror
the "accidentally powering off" part! It will update the flash memory when
we command it to do so.
Hope the scenario is clear now!
Did you really need this explanation to answer my question?

-- Nima Mohammadi

--0015174c3f449f007d048aba247b--

Re: How to slim MySQL?

am 06.07.2010 18:09:59 von mr.criptos

--00c09f972418f708f9048aba480e
Content-Type: text/plain; charset=ISO-8859-1

The more information, the easiest to pinpoint solutions.

delete all client and administrativ tools (mysql, mysqladmin, etc from the
"server", since you aren't doing any transactions, I think you can ditch all
engines excepto the isam/myisam, the basic one, also you migth want to leave
memory engine...

If I understand your project, you migth copy the database to the ram into a
tmpfs and if any change is needed, you update it, maybe to another engine??

What would I do. Build mysql in some machine, only copy mysqld and it's
libraries, start it and trace it with strace -e open to see what files does
it needs at startup. Supply them.

Add the database, run the aplication.

If not working, repeat... until it works...

that would be my approach, I think that would take like... 2 days at most.
Don't think about leaning down the mysql, better thik about providing what
it barely needs to run properly.

Good luck.





On Tue, Jul 6, 2010 at 10:59 AM, Nima Mohammadi wrote:

> On Tue, Jul 6, 2010 at 7:10 PM, mos wrote:
> Hope the scenario is clear now!
> Did you really need this explanation to answer my question?
>
> -- Nima Mohammadi
>

--00c09f972418f708f9048aba480e--

Re: How to slim MySQL?

am 07.07.2010 21:12:50 von Nima Mohammadi

--001636416817c1faa9048ad0f42a
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tue, Jul 6, 2010 at 8:39 PM, Andrés Tello wr=
ote:

> The more information, the easiest to pinpoint solutions.
>
> delete all client and administrativ tools (mysql, mysqladmin, etc from th=
e
> "server", since you aren't doing any transactions, I think you can ditch =
all
> engines excepto the isam/myisam, the basic one, also you migth want to le=
ave
> memory engine...
>
> If I understand your project, you migth copy the database to the ram into=
a
> tmpfs and if any change is needed, you update it, maybe to another engine=
??
>
> What would I do. Build mysql in some machine, only copy mysqld and it's
> libraries, start it and trace it with strace -e open to see what files do=
es
> it needs at startup. Supply them.
>
> Add the database, run the aplication.
>
> If not working, repeat... until it works...
>
> that would be my approach, I think that would take like... 2 days at most=
..
> Don't think about leaning down the mysql, better thik about providing wha=
t
> it barely needs to run properly.
>
> Good luck.
>
>
It seems like a reasonable (though time-consuming) approach. I'm going to
give it a try. I think watching for the open() function will suffice (strac=
e
-e open). Is there any other syscall I should be worry about?

-- Nima Mohammadi

--001636416817c1faa9048ad0f42a--