Skip to content

Performance Issues #40

Closed
Closed

Description

@vk2r

Hi, sorry for bothering you again. I'm not sure if I'm setting everything up correctly, but I don’t know how to properly configure my environment to achieve good performance.

I'm using Proxmox, with two LXC containers:

  • One running OpenWebUI
  • Another running the models, where I have Ollama along with the Olla and Sherpa engines in a single docker-compose setup.

When I connect OpenWebUI directly to Ollama, I receive a smooth and continuous stream of responses without any issues.

However, when I connect OpenWebUI through either Olla or Sherpa engines, the response streaming comes in bursts, leading to a poor user experience.

I’ve tested both engines (Olla and Sherpa), but I still haven’t found a configuration that delivers consistent streaming performance.

This is my configuration:

server:
  host: "0.0.0.0"
  port: 40114
  read_timeout: "5m"
  write_timeout: "0s"  # No timeout for streaming
  shutdown_timeout: "30s"
  request_logging: false  # Reduce log volume

request_limits:
  max_body_size: 104857600    # 100MB
  max_header_size: 1048576    # 1MB

rate_limits:
  global_requests_per_minute: 10000
  per_ip_requests_per_minute: 1000
  burst_size: 50
  health_requests_per_minute: 10000
  cleanup_interval: "5m"
  trust_proxy_headers: true  # Behind load balancer
  trusted_proxy_cidrs:
    - "10.0.0.0/8"
    - "172.16.0.0/12"

proxy:
  engine: "olla"  # High-performance engine
  load_balancer: "least-connections"
  connection_timeout: "30s"
  response_timeout: "30m"  # Long timeout for slow models
  read_timeout: "5m"
  max_retries: 3
  retry_backoff: "1s"
  stream_buffer_size: 65536  # 64KB for better streaming

discovery:
  type: "static"
  refresh_interval: 30s
  static:
    endpoints:
      - url: "http://ollama:11434"
        name: "server"
        type: "ollama"
        priority: 100
        model_url: "/api/tags"
        health_check_url: "/"
        check_interval: 2s
        check_timeout: 1s

      - url: "http://desktop:11434"
        name: "desktop"
        type: "ollama"
        priority: 10
        model_url: "/api/tags"
        health_check_url: "/"
        check_interval: 2s
        check_timeout: 1s

  model_discovery:
    enabled: true
    interval: 5m
    timeout: 30s
    concurrent_workers: 10
    retry_attempts: 3
    retry_backoff: 1s

model_registry:
  type: "memory"
  enable_unifier: true
  unification:
    enabled: true
    stale_threshold: 24h  # How long to keep models in memory after last seen
    cleanup_interval: 10m  # How often to check for stale models

logging:
  level: "info"  # debug, info, warn, error
  format: "json"  # json, text
  output: "stdout"  # stdout, file

engineering:
  show_nerdstats: false

I would really appreciate any guidance or help on how to properly set this up and improve performance. Thank you!

Activity

  1. self-assigned this
    on Aug 4, 2025
  2. added
    bug
    investigating
    on Aug 4, 2025
  3. thushan commented on Aug 4, 2025

    @thushan
    Owner

    Hey,

    Thanks, this seems to have been a regression, being the first day back at work for folks we had a few people wonder why it was so choppy.

    Before - first chunk:

    ❯ curl -N -X POST http://localhost:40114/v1/chat/completions   -H "Content-Type: application/json"   -d '{"model":"phi4:latest","messages":[{"role":"user","content":"Count to 10"}],"stream":true}'
    data: {"id":"chatcmpl-134","object":"chat.completion.chunk","created":1754307652,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Sure"},"finish_reason":null}]}
    

    Latest version - first chunk:

    curl -N -X POST http://localhost:40115/olla/ollama/v1/chat/completions   -H "Content-Type: application/json"   -d '{"model":"phi4:latest","messages":[{"role":"user","content":"Count to 10"}],"stream":true}'
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307730,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Sure"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307730,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"!"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307730,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Here"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307730,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" is"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307730,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" counting"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307731,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" from"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307731,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307731,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307731,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307731,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307731,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"10"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307732,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":":\n\n"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307732,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307732,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307732,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307732,"model":"phi4:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-429","object":"chat.completion.chunk","created":1754307732,"model":"phi4:latest","system
    

    We added buffering to help with another issue but this may have caused bigger issues.

    It's quite late but I will take a look at this tomorrow. We will have to add some streaming tests and make sure it doesn't happen again with a test suite..

    Thanks for reporting it. Will let you know what I find, nothing in config you can do at this stage.

  4. thushan commented on Aug 5, 2025

    @thushan
    Owner

    Good news, I've got a fix and now we're testing it across our test suites and added extra bits to capture any breakages in this area.

    To allow both streaming and buffering (which is useful for images or when stream: false) I've added an option in the config that should help.

      # Proxy Profile controls transport buffer behaviour
      # - "streaming" (or empty): No buffering, tokens stream immediately (default)
      # - "buffered": 64KB buffers for bulk transfers
      profile: "streaming"
      stream_buffer_size: 8192
    

    We should hopefully have the fix ready for you to test as a pre-release tonight (AEST) or tomorrow morning.

  5. thushan commented on Aug 5, 2025

    @thushan
    Owner

    We've released the fix for the token streaming bug as v0.0.14, this doesn't contain the profile enhancement mentioned above - that requires a bit more work, but we didn't want to delay the fix.

    Grab v0.0.14 and tell me if it solves the issue (it's in ghcr too). There's some test scripts in test/scripts/streaming to verify streaming moving forward too.

    Thanks for opening your issue!

  6. vk2r commented on Aug 6, 2025

    @vk2r
    Author

    The latest update has been great. The LLM streaming has worked correctly for me, and there's hardly any noticeable performance loss. I greatly appreciate this update.

    I apologize for the delay in responding. It’s been a tough week.

  7. thushan commented on Aug 6, 2025

    @thushan
    Owner

    hey mate, probs at all! Hopefully things get better, we're almost at the end of the week!

    Amazing to hear, there should be very little to no noticeable latency or overhead as everything on the hot path is very well tuned (at least the Olla proxy is).

    Proper documentation is still being written by someone and hopefully will be there next week.

    Feel free to close when you're able, and enjoy the weekend after a tough week!

  8. added
    resolved
    and removed
    investigating
    on Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugresolved

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions