Skip to content

Bundled libraries in redis #1825

Closed
Closed

Description

@cicku

Hi,

I'm the maintainer of this package in Fedora+EPEL now. I'd like to know why does redis use a copy of lua5.1 and hiredis.

  1. Lua 5.1. Is it ok to let redis use system lua as interpreter to provide the same fuction?
  2. hiredis. We've packaged hiredis as a standalone package in our repo, and in redis I see that hiredis is statically linked into redis, explanation?

Thank you!

Activity

  1. jbergstroem commented on Jun 19, 2014

    @jbergstroem
    Contributor

    1: the embedded lua is different. check scripting.c -- it embeds and expects additional modules.

    2: There's really nothing stopping you to modify the Makefile to make this happen. Make sure you use the same version though, since you're on your own otherwise.

    I've in the past also asked about moving closer to a shared library environment and was told that the static linking works well. My opinion aside, it is obviously working well and that is point enough.

    Gentoo takes a slightly different approach and uses shared libraries where feasible. We will also switch to a shared hiredis when redis updates their bundled library. You can read the ebuild (how its built) here.

    Also, relevant shared libraries build patch here.

  2. cicku commented on Jun 19, 2014

    @cicku
    Author

    I know the jemalloc patch, Fedora has shipped its own patch about jemalloc
    for a long time.

    I'm concerned about the hiredis now(cuz lua is not easy to unbundle).

  3. mattsta commented on Jun 19, 2014

    @mattsta
    Contributor

    Redis follows a policy of having zero configuration and zero external dependencies.

    But, as packager, you have options. The FreeBSD Redis system package adds build-time options allowing you to build against the system Lua or even LuaJIT. They don't bother changing any hiredis (or jemalloc) dependencies. See http://www.freshports.org/databases/redis and http://svnweb.freebsd.org/ports/head/databases/redis/ for how they approached it.

    Also, as @jbergstroem mentioned, Redis builds additional modules directly into Lua. If you provide your own Lua, you need to build those modules into Redis instead (see the FreeBSD patches for how they move Lua dependencies directly into the Redis binary.)

    hiredis is a bit different because it's not a direct include from upstream. The hiredis inside Redis replaces regular malloc calls with Redis-accountable zmalloc calls so Redis can maintain a better view of total memory usage. Also, even without the malloc changes, the version of hiredis inside Redis isn't always a tagged version of hiredis, so you can't rely on "Redis-x.y requires hireds-q.z."

    Feel free to suggest improvements around dependencies/packaging, but the answer may be "things are just that way for a reason."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions