question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[serve] Actor Ram size increases when sending large data

See original GitHub issue

What is the problem?

When sending video data (binary data and numpy arrays) to a ray serve endpoint the ram size of that worker encreases on each call. ram

While in the same time no object storage is used: image

Setup:

  • Ray: 1.0.1
  • OS: Ubuntu 18.04
  • Python: 3.7.5

Reproduction (REQUIRED)

I was able to reproduce it with that script:

import time
import requests
from ray import serve

client = serve.start()

def echo(flask_request):
    return "hello " + flask_request.args.get("name", "serve!")

client.create_backend("hello", echo)
client.create_endpoint("hello", backend="hello", route="/hello")
url = "http://localhost:8000/hello"
payload = {}

while True:
    
    files = [
        ('test', (
            'my_video-53.webm', open('./my_video-53.webm', 'rb'),
            'video/webm'))
        ]
    headers = {
        'apikey': 'asdfasfwerqexcz'
        }

    response = requests.request("GET", url, headers=headers, data=payload, files=files)
    time.sleep(1)

The videos I used hat between 1MB and 4MB, if it is smaller the changes are not that obvious

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
simon-mocommented, Nov 25, 2020

Hi @TanjaBayer, thanks for this report! I was able to reproduce it with the following script (swapped video file with np array) on latest master

import time
import requests
from ray import serve
import numpy as np
import io

client = serve.start()

def echo(flask_request):
    return "hello " + flask_request.args.get("name", "serve!")

client.create_backend("hello", echo)
client.create_endpoint("hello", backend="hello", route="/hello")
url = "http://localhost:8000/hello"
payload = {}

while True:
    
    files = [
        ('test', (
            'my_video-53.webm', io.BytesIO(np.zeros(4*1024*1024, dtype=np.uint8).tobytes()),
            'video/webm'))
        ]
    headers = {
        'apikey': 'asdfasfwerqexcz'
        }

    response = requests.request("GET", url, headers=headers, data=payload, files=files)
    time.sleep(1)

At start: image

After a minute image

(cc @edoakes )

0reactions
TanjaBayercommented, Dec 14, 2020

@edoakes not yet but there is an open discussion in slack about it

Read more comments on GitHub >

github_iconTop Results From Across the Web

What to Do When Your Data Is Too Big for Your Memory?
If the size of our data is larger than the size of our available memory (RAM), we might face some problems in getting...
Read more >
Fix an overloaded server - web.dev
Overview #. This guide shows you how to fix an overloaded server in 4 steps: Assess: Determine the server's bottleneck.
Read more >
Processing large JSON files in Python without running out of ...
The solution: process JSON data one chunk at a time. ... data fits in memory, the Python representation can increase memory usage even...
Read more >
What Is RAM, and How Much Memory Do You Need? - The Plug
Here's everything you need to know about what RAM does, and how to find out if you have enough memory you have on...
Read more >
Chapter 4. Query Performance Optimization - O'Reilly
Some queries just have to sift through a lot of data and can't be helped. ... a few rows and then ask the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found