deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michal Fojtik (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DTACLOUD-347) Deltacloud API leaking memory
Date Thu, 18 Oct 2012 13:24:02 GMT

    [ https://issues.apache.org/jira/browse/DTACLOUD-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13478991#comment-13478991
] 

Michal Fojtik commented on DTACLOUD-347:
----------------------------------------

I created a small patch that can help tracking memory usage for some 'blocks' of code or print
the 'current' memory usage of DC:

def get_current_memory_usage
  `ps -o rss= -p #{Process.pid}`.to_i
end

def profile_memory(&block)
  before = get_current_memory_usage
  file, line, _ = caller[0].split(':')
  if block_given?
    instance_eval(&block)
    puts "[#{file}:#{line}: #{(get_current_memory_usage - before) / 1024} MB]"
  else
    before = 0
    puts "[#{file}:#{line}: #{(get_current_memory_usage - before) / 1024} MB (current)]"
  end
end

The output in log:

 ~/code/core/server › ./bin/deltacloudd -i mock
Starting Deltacloud API :: mock :: http://localhost:3001/api

[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:30: 33 MB (current)]
>> Thin web server (v1.5.0 codename Knife)
>> Debugging ON
>> Maximum connections set to 1024
>> Listening on localhost:3001, CTRL+C to stop
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 41 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:46] "GET /api HTTP/1.1" 200 1241 0.0365
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 42 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:49] "GET /api HTTP/1.1" 200 1241 0.0295
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 43 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:51] "GET /api HTTP/1.1" 200 1241 0.0515
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 44 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:51] "GET /api HTTP/1.1" 200 1241 0.0499
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 45 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:51] "GET /api HTTP/1.1" 200 1241 0.0436
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 47 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:51] "GET /api HTTP/1.1" 200 1241 0.0286
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 48 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:52] "GET /api HTTP/1.1" 200 1241 0.0291
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 50 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:52] "GET /api HTTP/1.1" 200 1241 0.0295
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 51 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:52] "GET /api HTTP/1.1" 200 1241 0.0274
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 53 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:52] "GET /api HTTP/1.1" 200 1241 0.0281
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 54 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:53] "GET /api HTTP/1.1" 200 1241 0.0421
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 55 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:53] "GET /api HTTP/1.1" 200 1241 0.0447
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 56 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:53] "GET /api HTTP/1.1" 200 1241 0.0250
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 57 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:53] "GET /api HTTP/1.1" 200 1241 0.0259
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 58 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:54] "GET /api HTTP/1.1" 200 1241 0.0252
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 59 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:54] "GET /api HTTP/1.1" 200 1241 0.0278
[/home/mfojtik/code/core/server/lib/deltacloud/server.rb:51: 61 MB (current)]
127.0.0.1 - - [18/Oct/2012 15:20:54] "GET /api HTTP/1.1" 200 1241 0.0266
                
> Deltacloud API leaking memory
> -----------------------------
>
>                 Key: DTACLOUD-347
>                 URL: https://issues.apache.org/jira/browse/DTACLOUD-347
>             Project: DeltaCloud
>          Issue Type: Bug
>          Components: Server
>         Environment: deltacloud-core, GIT adade32451815c8ee28e29be35636bd0f98473fc
>            Reporter: Michal Fojtik
>            Priority: Blocker
>              Labels: blocker-1.0.5
>
> Deltacloud API memory usage is slowly increasing after doing 100+ requests:
> Starting Deltacloud API :: mock :: http://localhost:3001/api
> >> Thin web server (v1.5.0 codename Knife)
> >> Debugging ON
> >> Maximum connections set to 1024
> >> Listening on localhost:3001, CTRL+C to stop
> 127.0.0.1 - - [17/Oct/2012 15:26:10] "GET /api/images HTTP/1.1" 200 4420 0.0308
> 127.0.0.1 - - [17/Oct/2012 15:26:17] "GET /api/images HTTP/1.1" 200 4420 0.0220
> 127.0.0.1 - - [17/Oct/2012 15:26:52] "GET /api/images HTTP/1.1" 200 4420 0.0219
> ... 1000 requests after:
> 127.0.0.1 - - [17/Oct/2012 15:27:53] "GET /api/images HTTP/1.1" 200 4420 0.1539
> 127.0.0.1 - - [17/Oct/2012 15:27:53] "GET /api/images HTTP/1.1" 200 4420 0.1554
> 127.0.0.1 - - [17/Oct/2012 15:27:53] "GET /api/images HTTP/1.1" 200 4420 0.1526
> As you can see the response time is slowly increasing and after few minutes it gets to
the point where the request take like 10 seconds to complete and all your free memory is gone
;-)
> This is easy to reproduce:
> 1. Start Deltacloud API ($ deltacloudd -i mock)
> 2. $ while true; do curl -H 'Accept: application/xml' --user 'mockuser:mockpassword'
http://localhost:3001/api/images > /dev/null; done
> 3. Keep it running for ~1minute and watch the console with Deltacloud API log.
> Thanks to Tomas Hrcka for reporting this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message