Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64486

Re: Self healthcheck

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <nicholas.cole@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'cpython': 0.05; 'detect': 0.07; 'referring': 0.07; 'wednesday,': 0.07; '22,': 0.09; 'advice.': 0.09; 'finished.': 0.09; 'happen,': 0.09; 'objects,': 0.09; 'references,': 0.09; 'run,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'bug': 0.12; 'assume': 0.14; 'behave': 0.16; 'deduced': 0.16; 'flush': 0.16; 'garbage': 0.16; 'happily': 0.16; 'heap': 0.16; 'highlight': 0.16; 'indirectly': 0.16; 'leaks': 0.16; 'mutable': 0.16; 'subject:Self': 0.16; 'throughput': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'app': 0.19; 'module': 0.19; 'slightly': 0.19; 'later': 0.20; 'code,': 0.22; 'input': 0.22; 'memory': 0.22; '(in': 0.22; 'email addr:gmail.com&gt;': 0.22; 'spread': 0.22; 'cc:addr:python.org': 0.22; 'candidates': 0.23; "aren't": 0.24; 'module,': 0.24; 'typical': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; '&gt;': 0.26; 'define': 0.26; 'extension': 0.26; 'references': 0.26; 'second': 0.26; 'header:In- Reply-To:1': 0.27; 'record': 0.27; 'correct': 0.29; 'chris': 0.29; 'generally': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'that.': 0.31; 'usually': 0.31; '(maybe': 0.31; 'about.': 0.31; 'app.': 0.31; 'figure': 0.32; 'running': 0.33; 'checking': 0.33; 'entirely': 0.33; 'not.': 0.33; 'candidate': 0.34; 'could': 0.34; 'problem': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'representing': 0.36; 'possible': 0.36; 'january': 0.37; 'las': 0.37; 'skip:& 10': 0.38; 'mapping': 0.38; 'track': 0.38; 'enough': 0.39; 'remove': 0.60; 'analyze': 0.60; 'truly': 0.60; 'units': 0.60; 'up,': 0.60; 'most': 0.60; 'healthy': 0.61; 'traffic': 0.61; 'simply': 0.61; "you're": 0.61; 'here:': 0.62; "you'll": 0.62; 'name': 0.63; 'such': 0.63; 'map': 0.64; 'places': 0.64; 'different': 0.65; 'talking': 0.65; 'to:addr:gmail.com': 0.65; 'yes': 0.68; 'to,': 0.72; 'programs,': 0.74; '100': 0.79; '2014,': 0.84; 'detecting': 0.84; '\xa0but': 0.84; 'good,': 0.91; 'thing,': 0.91; 'mistakes': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7Sp8FkYAdoVIkjQv3Y5AjrvJ1bwULZgDA0dzDdyo+5E=; b=UGHPuliEt/Gv+7IAUGqH8GnZS0IUoQfXJoOIZyqLqdy73YgH03qkaw2qc01JQ4BaKc mwjF5FIPBF/8m2DGEAq3sqWFyzTk5v0qand+OZkF59sZFVmC84bndQuhMdCJi/q+S6XC 0N2xFmK5GsPBst9q8edzxF7covCRaoit5FiKAW7aj8S6OExywMX0Al9FHh9zVP2KZY6C N2JCcK86fFJWm527p2QmHGxuF5RHyrPD729rVo4yMIZp5FZwuF6Fl+pwtUggrkb1DihJ xKVqpOCaiIZ8VlfWKDfmmNA99PSfcwFjeVOhtMOykK/wldPZcUdNISDdIc+EZWBvrnHo j7Xw==
MIME-Version 1.0
X-Received by 10.14.114.70 with SMTP id b46mr280214eeh.84.1390380219785; Wed, 22 Jan 2014 00:43:39 -0800 (PST)
In-Reply-To <58c541ab-c6e1-45a8-b03a-8597ed7ecb48@googlegroups.com>
References <0d1fc1a7-c585-45ba-8c1a-0cc468712a48@googlegroups.com> <mailman.5829.1390360114.18130.python-list@python.org> <58c541ab-c6e1-45a8-b03a-8597ed7ecb48@googlegroups.com>
Date Wed, 22 Jan 2014 08:43:39 +0000
Subject Re: Self healthcheck
From Nicholas Cole <nicholas.cole@gmail.com>
To Asaf Las <roegltd@gmail.com>
Content-Type multipart/alternative; boundary=001a1133f0781a66f204f08b1fec
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5831.1390380226.18130.python-list@python.org> (permalink)
Lines 137
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1390380226 news.xs4all.nl 2906 [2001:888:2000:d::a6]:37349
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64486

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wednesday, 22 January 2014, Asaf Las <roegltd@gmail.com> wrote:

> On Wednesday, January 22, 2014 5:08:25 AM UTC+2, Chris Angelico wrote:
> > I assume you're talking about pure Python code, running under CPython.
> > (If you're writing an extension module, say in C, there are completely
> > different ways to detect reference leaks; and other Pythons will
> > behave slightly differently.) There's no way to detect truly
> > unreferenced objects, because they simply won't exist - not after a
> > garbage collection run, and usually sooner than that. But if you want
> > to find objects that you're somehow not using and yet still have live
> > references to, you'll need to define "using" in a way that makes
> > sense. Generally there aren't many ways that that can happen, so those
> > few places are candidates for a weak reference system (maybe you map a
> > name to the "master object" representing that thing, and you can
> > recreate the master object from the disk, so when nothing else is
> > referring to it, you can happily flush it out - that mapping is a good
> > candidate for weak references).
> >
> > But for most programs, don't bother. CPython is pretty good at keeping
> > track of its own references, so chances are you don't need to - and if
> > you're seeing the process's memory usage going up, it's entirely
> > possible you can neither detect nor correct the problem in Python code
> > (eg heap fragmentation).
> > ChrisA
>
> Hi Chris
>
> Yes the question was about CPython. But i am not after CPython leaks
> though detecting these would be good, but my own mistakes leading to
> accumulation of data in mutable structures.
> there will be few processes running python code standalone communicating
> across servers and every activity will be spread over time so
> i have to persistently keep record of activity and remove it later when
> activity is finished. In addition to checking objects directly i would
> like to analyze also app health indirectly via checking amount of data
> it holds. let say there is permanently 100 activities per second and
> typical object count figure is 1000 (in abstract units averaged over long
> enough time window), so i would check throughput and memory to see if my
> program is healthy in terms of leaking resources and generate log if it
> is not.
> Input to such module will be traffic events (whatever event significant
> to object creation).
> So i am looking for proper way to detect memory held by CPython app. And
> it would be good if memory can be deduced down to object/class name so
> blamed one could be identified and reported.
>
>
There are some good tools recommended here:

http://stackoverflow.com/questions/110259/which-python-memory-profiler-is-recommended

 But in general: use weak references wherever possible would be my advice.
They not only prevent cycles but will highlight the kinds of bug in your
code that is likely to cause the sort of problem you are worried about.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Self healthcheck Asaf Las <roegltd@gmail.com> - 2014-01-21 18:51 -0800
  Re: Self healthcheck Chris Angelico <rosuav@gmail.com> - 2014-01-22 14:08 +1100
    Re: Self healthcheck Asaf Las <roegltd@gmail.com> - 2014-01-22 00:18 -0800
      Re: Self healthcheck Nicholas Cole <nicholas.cole@gmail.com> - 2014-01-22 08:43 +0000
        Re: Self healthcheck Asaf Las <roegltd@gmail.com> - 2014-01-22 07:51 -0800
      Re: Self healthcheck "Frank Millman" <frank@chagford.com> - 2014-01-22 10:56 +0200
        Re: Self healthcheck Asaf Las <roegltd@gmail.com> - 2014-01-22 08:03 -0800
          Re: Self healthcheck Dave Angel <davea@davea.name> - 2014-01-22 13:40 -0500
          Re: Self healthcheck "Frank Millman" <frank@chagford.com> - 2014-01-23 07:36 +0200

csiph-web