ZODB ZEO

Introdução

ZOBD é o banco de dados Orientado a Objeto do Zope (Zope Object Data Base), e este possui duas configurações de uso, stand alone e ZEO (Zope Enterprise Object)

A configuração stand alone, é indicada para ser aplicada no desenvolvimento, testes, homologação e protótipos, nunca em produção; e a configuração ZEO, em ambientes de produção.




O Framework ZOPE vem com alguns scripts para gerenciamento do ZODB, disponíveis em http://svn.zope.org, mas que já estão incorporados no conjunto de instalação. Normalmente estes scripts estão localizados no $INSTALLDIR/bin.


Explorando o ZEO


# 20111031_fss/bin/analyze.py 20111031_fss/zeocluster/server/var/Data.fs

Processed 84579 records in 135 transactions
Average record size is  601.03 bytes
Average transaction size is 376551.19 bytes
Types used:
Class Name                                       Count    TBytes    Pct AvgSize
---------------------------------------------- ------- ---------  ----- -------
                    1       137   0.0%  137.00
              1        65   0.0%   65.00
...ApplicationManager.ApplicationManager'>           2       480   0.0%  240.00
                      107    128976   0.3% 1205.38
                108    368056   0.7% 3407.93
                     15     46898   0.1% 3126.53
               34     37225   0.1% 1094.85
         57     12750   0.0%  223.68
         30      2850   0.0%   95.00
           275     97139   0.2%  353.23
              106     34213   0.1%  322.76
               217    366755   0.7% 1690.12
               12     12588   0.0% 1049.00
                  6      9955   0.0% 1659.17
                       3465    202461   0.4%   58.43
                             8     91811   0.2% 11476.38
                           13    131243   0.3% 10095.62
                           48   3318002   6.5% 69125.04
...mapping.PersistentMapping'>                    8062   5809101  11.4%  720.55
...BTreeFolder2.BTreeFolder2.BTreeFolder2'>          5      1090   0.0%  218.00
...ZopePageTemplate.ZopePageTemplate'>               9     15326   0.0% 1702.89
...DateIndex.DateIndex.DateIndex'>                  43     16666   0.0%  387.58
...DateRangeIndex.DateRangeIndex'>                   5      2270   0.0%  454.00
...FieldIndex.FieldIndex.FieldIndex'>              110     40400   0.1%  367.27
...KeywordIndex.KeywordIndex.KeywordIndex'>        236     87822   0.2%  372.13
...PluginIndexes.TextIndex.Lexicon.Lexicon'>        19      6460   0.0%  340.00
...TextIndex.TextIndex.TextIndex'>                 106     31286   0.1%  295.15
...BrowserIdManager.BrowserIdManager'>               1       307   0.0%  307.00
...SessionDataManager.SessionDataManager'>           1       239   0.0%  239.00
...SessionDataManagerTraverser'>                     1       161   0.0%  161.00
...VirtualHostMonster.VirtualHostMonster'>           1        97   0.0%   97.00
...SiteErrorLog.SiteErrorLog.SiteErrorLog'>          6       630   0.0%  105.00
...AcceleratedHTTPCacheManager'>                     5      1629   0.0%  325.80
...RAMCacheManager.RAMCacheManager'>                 5      1674   0.0%  334.80
...ZCTextIndex.OkapiIndex.OkapiIndex'>              15      5295   0.0%  353.00
...ZCTextIndex.ZCTextIndex.PLexicon'>               15      6957   0.0%  463.80
...ZCTextIndex.ZCTextIndex.ZCTextIndex'>            15      4245   0.0%  283.00
        111     52710   0.1%  474.86
      106     16516   0.0%  155.81
...MountedObject.MountedObject'>                     1       141   0.0%  141.00
...ZopeTutorial.TutorialTopic.GlossaryTopic'>        1       146   0.0%  146.00
...ZopeTutorial.TutorialTopic.TutorialTopic'>       14      2058   0.0%  147.00
       3       305   0.0%  101.67
============================================== ======= =========  ===== =======
                            Total Transactions     135                  367.73k
                                 Total Records   84579    49642k  21.6%  601.03
                               Current Objects   13273    10343k  20.8%  798.00
                                   Old Objects     128      364k   0.7% 2916.41

#20111031_fss/bin/fsdump.py 20111031_fss/zeocluster/server/var/Data.fs

[...]
data #08657 oid=0000000000012e72 size=323 class=BTrees._IOBTree.IOBTree
data #08658 oid=0000000000012e71 size=29 class=BTrees.Length.Length
data #08659 oid=0000000000012e70 size=676 class=BTrees._OOBTree.OOBTree
Trans #00133 tid=03924527d23d69aa time=2011-11-08 10:47:49.274975 offset=54394637
status=' ' user=' admin' description='/dirti-cgti/cgti/portal_fss/manage_editProperties'
data #00000 oid=000000000001066c size=274 class=Products.FileSystemStorage.FSSTool.FSSTool
Trans #00134 tid=039245284406d8aa time=2011-11-08 10:48:15.943768 offset=54395039
status=' ' user=' admin' description='/dirti-cgti/cgti/portal_fss/manage_editProperties'
data #00000 oid=000000000001066c size=274 class=Products.FileSystemStorage.FSSTool.FSSTool

# 20111031_fss/bin/fstail.py 20111031_fss/zeocluster/server/var/Data.fs
2011-11-08 10:48:15.943768: hash=119470e8d6f46756af9383bafa01a9705276d6ea
user=' admin' description='/dirti-cgti/cgti/portal_fss/manage_editProperties' length=394

2011-11-08 10:47:49.274975: hash=be34a45abe0dfcd45ce69b0542a4bdf804892598
user=' admin' description='/dirti-cgti/cgti/portal_fss/manage_editProperties' length=394

2011-11-01 11:50:14.448818: hash=efd44baf484595b39cfbff763b20d381d515ba1a
user=' admin' description='/sacpr-aviacaocivil/manage_importObject' length=4516800

2011-10-31 17:06:16.232790: hash=2e7f6371f12d45e8350adb9830bd197f7e967399
user=' admin' description='/dirti-cgti/cgti/fss_management_form' length=379

2011-10-31 17:05:48.630783: hash=e9bef0ce6294c0e4f6af55d57e848c95f4a6021f
user=' admin' description='/dirti-cgti/cgti/fss_management_form' length=399

2011-10-31 17:05:10.346793: hash=f9ebb109e6fec48dd895f06dceb073abc4b7c47e
user=' admin' description='/dirti-cgti/cgti/fss_management_form' length=379

2011-10-31 16:59:07.512094: hash=cd3f1c7133accc6071b7a2cff0c0c20fff8d6a25
user=' admin' description='/sacpr-aviacaocivil/manage_delObjects' length=849047

2011-10-31 16:58:26.881803: hash=77bc7185720833cd5a362ea1de2a82cfc137a598
user=' admin' description='/sacpr-aviacaocivil/aviacaocivil/portal_fss/manage_editProperties' length=430

2011-10-31 16:51:38.741950: hash=81d01f04a5f10436b6c07004532524282f6ccd74
user=' admin' description='/dirti-cgti/manage_importObject' length=3887606

2011-10-31 16:51:02.608649: hash=80a84b798fe9d9575a8bb112bf553bb20f77c4ed
user=' admin' description='/saf-projetos/manage_importObject' length=4164217

20111031_fss/bin/checkbtrees.py 20111031_fss/zeocluster/server/var/Data.fs

[..]
['Application'].Control_Panel.Products.RichEvent.Help.catalog._catalog._length
['Application'].Control_Panel.Products.RichEvent.Help.catalog._catalog.data
total 81296 found 1181

# 20111031_fss/bin/fsrefs.py 20111031_fss/zeocluster/server/var/Data.fs

oid 0x14618L BTrees._IIBTree.IISet
last updated: 2011-11-01 11:50:14.448818, tid=0x3921E063DA5F655L
refers to invalid object:
oid ('\x00\x00\x00\x00\x00\x01F\x19', None) missing: ''

oid 0x14619L BTrees._IIBTree.IISet
last updated: 2011-11-01 11:50:14.448818, tid=0x3921E063DA5F655L
refers to invalid object:
oid ('\x00\x00\x00\x00\x00\x01F\x1a', None) missing: ''

Referências

http://plone.org/documentation/kb/debug-zodb-bloat
http://svn.zope.org/ZODB/trunk/src/ZODB/scripts/

Comentários