Neo4j 服务器设置建议

发布于 2024-09-28 10:40:57 字数 1289 浏览 3 评论 0原文

我正在 jRuby 中设置一个基于 Neo4j 的系统,在 glassfish 上运行。 Glassfish 与大多数 Rails 系统一样,允许某种机制运行多个实例。在 glassfish 情况下,有一个线程池大小的内部设置。

我的问题是 Neo4j 数据库多次打开时遇到问题,这导致了错误。我正在升级到 Rails3 以获取最新的 Neo4j.rb,但同时想确保我拥有正确的服务器设置。

以下是我的设置:

#
# GlassFish configuration.
#
# Please read the comments for each configuration settings before modifying.
#
# application environment. Default value development

environment: staging
# HTTP configuration
  http:
    # port
    port: 3000

    #address
    address: 0.0.0.0

    # context root. The default value is '/'
    contextroot: /

    # Grizzly is NIO based HTTP libraries used by GlassFish gem
    grizzly:
        chunking-enabled: true
        request-timeout: 30
        send-buffer-size: 8192
        max-keepalive-connextions: 256
        keepalive-timeout: 30
        thread-pool:
            idle-thread-timeout-seconds: 900
            max-queue-size: 4096
            max-thread-pool-size: 5
            min-thread-pool-size: 2                
#Logging configuration
log:
    log-level: all
jruby-runtime-pool:
    initial: 1
    min: 1
    max: 5
daemon:
    enable: true

jvm-options: -server -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewRatio=2 -XX:+DisableExplicitGC -Dhk2.file.directory.changeIntervalTimer=6000

I am setting up a Neo4j based system in jRuby running on glassfish. Glassfish as with most rails systems allows for some mechanism to run multiple instances. In glassfish case there is an internal setting for the thread pool size.

My issue is that I am having problems with the Neo4j database being opened more than once and this is causing an error. I am in the process of upgrading to Rails3 to pull in the latest Neo4j.rb but in the mean time wanted to assure I had the right server setup.

Below is my setup:

#
# GlassFish configuration.
#
# Please read the comments for each configuration settings before modifying.
#
# application environment. Default value development

environment: staging
# HTTP configuration
  http:
    # port
    port: 3000

    #address
    address: 0.0.0.0

    # context root. The default value is '/'
    contextroot: /

    # Grizzly is NIO based HTTP libraries used by GlassFish gem
    grizzly:
        chunking-enabled: true
        request-timeout: 30
        send-buffer-size: 8192
        max-keepalive-connextions: 256
        keepalive-timeout: 30
        thread-pool:
            idle-thread-timeout-seconds: 900
            max-queue-size: 4096
            max-thread-pool-size: 5
            min-thread-pool-size: 2                
#Logging configuration
log:
    log-level: all
jruby-runtime-pool:
    initial: 1
    min: 1
    max: 5
daemon:
    enable: true

jvm-options: -server -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewRatio=2 -XX:+DisableExplicitGC -Dhk2.file.directory.changeIntervalTimer=6000

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拿命拼未来 2024-10-05 10:40:57

您可以尝试将 jruby-runtime-pool 最大值设置为 1(尚未对此进行测试)。
如果您正在运行一个多线程应用程序(例如 Rails 3 和 Neo4j),我认为没有必要使用多个 jruby-runtime,对吗?

You can try setting the jruby-runtime-pool max value to 1 instead (have not tested this).
If you are running a multithreaded application (like rails 3 and Neo4j) I think there is no need to use more then one jruby-runtime, right ?

疧_╮線 2024-10-05 10:40:57

Neo4j.start 方法采用一个可选的 Neo 数据库实例。我还没有尝试过,但如果您可以尝试确保只创建一个 Neo 实例,并确保每个运行时首先查找该共享实例,那么您的多运行时方法可能会起作用。

共享实例放在哪里?如果您在 servlet 上下文中运行,则可以将其放入 servlet 上下文属性中。既然您不是,最好的方法可能是编写一个小的 Java 包装类来启动和存储单个实例,并将该 Java 类导入每个运行时。

The method Neo4j.start takes an optional Neo database instance. I haven't tried it but if you can experiment with ensuring that only one Neo instance gets created and make sure that each runtime looks for that shared instance first, your multiple runtime approach might work.

Where to put the shared instance? If you were running in a servlet context you could put it in a servlet context attribute. Since you're not, the best way would probably be to write a small Java wrapper class for starting and storing the single instance, and importing that Java class into each runtime.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文