Git Product home page Git Product logo

Comments (2)

MarkBaggett avatar MarkBaggett commented on June 25, 2024

Yes and no. You can run multiple instances on the same server with a small change to line 25 in the code. The IP Port is a configuration option in apiify.yaml. BUT the config file is hard coded. So you would have to change:

This line:

config = config.config("apiify.yaml")

to this:

import sys

if len(sys.argv)== 1:
    config = config.config("apiify.yaml")
else:
    config = config.config(sys.argv[1])

Then you can pass the yaml file when you start the program like this..

python apiify.py apiify_config1.yaml

Then in a second config, change the port number and pass it to the second instance.

Note: Each instance would have its own in memory cache. They are not shared across the instances like domain stats. I would need to rewrite components to have a disk backed cache for that. So you wouldn't want to have two traceroutes on two servers. Since the cache isn't shared they would duplicate efforts.

IF you are doing traceroute, that is going to be a performance dog. BE SURE to use ALL the options from the sample config (-n -q1 -f???) It will be FASTER if you use "--udp -p 53" and increase the -f3 to -f5 or -f6. Of course the higher the -f value the more of your infrastructure you are ignoring. Find the right balance for you for performance and useful data.

from apiify.

fopson avatar fopson commented on June 25, 2024

Thanks @MarkBaggett for the quick response. I completely forgot about the config file location being hardcoded. I applied the above change with some extra changes to cancel the prompt and rather pass loadcache as an argument. It make it easier to run the tool as a service.

import sys

if len(sys.argv)== 1:
    config = config.config("apiify.yaml")
elif len(sys.argv)== 2:
    config = config.config(sys.argv[1])
else:
    config = config.config(sys.argv[1])
    load_cache = sys.argv[2]

and then

if __name__ == "__main__":
    if pathlib.Path(config['cache_file']).exists() and load_cache=="loadcache":
        exec_command.cache.cache_load(config['cache_file'])

Now, as suggested, starting the programs like this...

python apiify.py /path/to/apiify_config1.yaml loadcache

And both instances work as expected now and I am thinking about running a 3rd instance to that will run another script behind the scenes and present the results if performance allows. Thanks again for your quick response.

For traceroute I have been using all the options in the sample config file with -f9 since the last hop in our ISP seem to be vary between hop 9 and hop 10. I haven't been using "--udp -p 53". I will give it a try and see how goes.

from apiify.

Related Issues (2)

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.