GithubHelp home page GithubHelp logo

Comments (4)

hp197 avatar hp197 commented on June 24, 2024

This would be nice and cool to have, but I doubt it'll give you much more speed when you have multiple workers.

In my personal tests, the limiting factor with 8 workers was the mutex and not the disk IO.
But this might have improved with #40

Looking at the preload:

    if options[:preload] || !IO.respond_to?(:pread)
      @mutex = Mutex.new
    end

and on read of the database:

  def atomic_read(length, pos)
    if @mutex
      @mutex.synchronize { atomic_read_unguarded(length, pos) }
    else
      atomic_read_unguarded(length, pos)
    end
  end

  def atomic_read_unguarded(length, pos)
    if @use_pread
      IO.pread(@file.fileno, length, pos)
    else
      io = @contents || @file
      io.seek(pos)
      io.read(length)
    end
  end

(preload is pumped into @contents as StringIO).

So preloading isn't going to help much if you want to counter the mutex.
Secondly, I dont think that the database will be re-readed into memory every now end then, so if you preload, you'll need to restart logstash if the geo database is updated.

from logstash-filter-geoip.

hp197 avatar hp197 commented on June 24, 2024

I have to test a bit more on this, but first runs with preloading didn't show any major improvements.

That I didnt see any major improvement might be explainable by the fact that GeoIP databases are rather small and fit into OS cache easily, so most of the time they will be cached by the OS anyway.

from logstash-filter-geoip.

jordansissel avatar jordansissel commented on June 24, 2024

I wouldn't expect preloading to really improve much since the file generally lives happily within filesystem cache.

from logstash-filter-geoip.

suyograo avatar suyograo commented on June 24, 2024

We've added a LRU cache for recent lookups, so closing this.

from logstash-filter-geoip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.