Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make docker image more portable #1233

Merged
merged 2 commits into from
Jan 28, 2023
Merged

Conversation

PragmaTwice
Copy link
Member

It is a known issue that some users encountered "illegal instruction" crash while using our docker images, see #1146.

After investigation, RocksDB use march=native while the PORTABLE option is set to OFF.

We keep the default behavior for best performance, but use PORTABLE=ON in docker images to prevent illegal instructions.

Dockerfile Outdated
@@ -26,7 +26,7 @@ RUN apt install -y git gcc g++ make cmake autoconf automake libtool python3 libs
WORKDIR /kvrocks

COPY . .
RUN ./x.py build -DENABLE_OPENSSL=ON
RUN ./x.py build -DENABLE_OPENSSL=ON -DPORTABLE=ON
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why portable is ON if the binary is built inside Ubuntu and is launching inside Ubuntu?
I guess arch-specific optimizations could be applied in this case because we are fully aware of the target platform (Ubuntu). Correct me if I'm wrong.

Copy link
Member Author

@PragmaTwice PragmaTwice Jan 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, if the build machine (Travis CI here) has avx512 instructions, the built binary will use these instructions to perform vectorize optimization if -march=native is ON. But maybe user's device does not support avx512.

Dockerfile Outdated
@@ -26,7 +26,7 @@ RUN apt install -y git gcc g++ make cmake autoconf automake libtool python3 libs
WORKDIR /kvrocks

COPY . .
RUN ./x.py build -DENABLE_OPENSSL=ON
RUN ./x.py build -DENABLE_OPENSSL=ON -DPORTABLE=ON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest adding an ARG and defaulting to ON.

Our image can always use the default but if users are certain for the platform they can build their own with PORTABLE=OFF.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. since other build arguments can also have this problem like ENABLE_SSL, DISABLE_JEMALLOC, so I add $MORE_BUILD_ARGS instead of $PORTABLE for more general purpose.

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment above.

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For confirmation, will MORE_BUILD_ARGS override ENABLE_OPENSSL and PORTABLE if specified?

@PragmaTwice
Copy link
Member Author

For confirmation, will MORE_BUILD_ARGS override ENABLE_OPENSSL and PORTABLE if specified?

Yeah.

@PragmaTwice
Copy link
Member Author

Thanks all. Merging...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants