Jump to content

Community Info: Strip Nginx and Php binaries


Recommended Posts

Posted

Hello

Another day another tip 🙂

2chreo0.png

Strip your Nginx and Php binaries and get around 50% smaller file size....

Linux man strip info:

https://linux.die.net/man/1/strip

In Unix and Unix-like operating systems, the strip program removes inessential information from executable binary programs and object files, thus potentially resulting in better performance and sometimes significantly less disk space usage ('inessential information' means information that is not required for correct functioning of the binary in normal execution). This information may consist of debugging and symbol information; however the standard leaves the scope of changes up to the implementer.

Furthermore, the use of strip can improve the security of the binary against reverse engineering. It will be more difficult to analyze a binary without its information and object's names.

Enjoy !

Posted

Stripping binaries is really only useful for reducing disk space, and is not practically ever useful or necessary outside of maybe ARM devices where storage space is highly limited.

It doesn't make any difference to performance on modern systems, and it can consequently make debugging crashes and the likes more difficult.

It's also not something you should do if you're installing Nginx and PHP from a repository rather than compiling from source (which is generally also not recommended), as the package maintainer will have compiled and optimized the binaries in the best manner already and these binaries should not be touched.

Posted

I am talking about building from source 🙂

For the rest most of them are already optimized.

I use source as i like to add my custom optimizations and adjustments so if anyone doing the same then it may be useful to do the strip binary also.

For example the PHP PGO is not added on the repo but you can add it on source compiling and it can offer a performance boost.

Posted

Sure, but keep in mind that stripping binaries does not actually improve performance and all it does is save a tiny bit of disk space by reducing the size of the binary. It's a common misunderstanding that "a smaller filesize must mean better performance," and while stripping some binaries may have helped marginally improve performance decades ago, this is no longer the case 🙂

Posted

The primary benefit, for the vast majority of cases, is just to save disk space. Saving 10mb's on a modern server doesn't mean something...

A secondary, and much more dubious benefit, is that it also makes the binary more difficult to disassemble or reverse engineer.

It may also reduce the memory footprint a little, though in many cases it'll be a negligible savings.

I think now is more clear 🙂

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...