Database Management for Smalltalk

Archive for the 'FAQ' Category

Thu 20th Dec 2007   01:12 PM
posted by John Clapperton

Q:  “Our application kicks off with a menu where icons are clicked to invoke windows which have their own transaction to the database.  How does an application connect to a VOSS virtual space and automatically disconnect when the menu is closed?”

A:  To clarify terminology: “connecting” to a virtual space means making the image aware of its existence, requiring a pathname; “log-on” to a virtual space means opening the files in that image and registering that image’s log-on in the space’s dictionary of current accesses (using the ImageID set when VOSS is installed in the image) by the system’s private log-on transaction.  There’s no need to log-off after every transaction, but the two operations could be combined like this:

  | vom customers departments |
  [ [ vom := VOManager newForExistingSpace: ‘c:\vospaces\myspace’. “connect”
      vom isNil ifTrue: [^self].
      vom open ifFalse: [^self].                                   “log-on”
      [ customers := vom rootDictionary at: ‘customers’.
        departments := vom rootDictionary at: ‘departments’
      ] atomicReadOnly.
      …
      …
      …
    ] ensure:
      [ vom notNil ifTrue: [vom close; disconnect]]
  ] forkAt: (Processor userBackgroundPriority).

Thu 20th Dec 2007   12:12 PM
posted by John Clapperton

Q:  “I created 10,000 objects in one transaction and then updated all of them in another transaction.  How big can I make the cache?”

A:  For performance reasons it’s important to set the maximum cache size big enough to accommodate the number of objects in your largest transaction.  The reason for this is that whilst the cache will always expand, even beyond its set maximum size, to hold all the objects in all the currently open transactions, whilst it is larger than the max size it is significantly slower.  This is because each time an object is added to the cache, when at its max size, it searches for the least recently used unlocked object (not included in any transaction) and removes it; this is a linear search from the tail end of the cache and is thus long and fruitless when there are no unlocked objects left in it.

The cache can be set to any size compatible with available physical memory; the memory occupied is displayed in the Control Panel when ByteSizeCalculation is enabled, though in normal use this should be disabled because the calculation takes time.

If the first transaction after log-on virtualizes 10000 objects there will be a lot of disk activity; this is because the pre-allocation cache (pac) is initialized to 25 new objects and when these have all been allocated during the growing (application-in-control) phase of a transaction,  subsequent new virtualizations require disk writes and therefore file flushing to maintain file integrity.  Whenever a transaction commits after having had to create new virtual objects in excess of the pac size it remembers this and expands the pac by this number as part of the transaction commit, so the next transaction to create 10000 new objects will be able to get them all from the pac, saving all that disk activity. Unallocated objects still in the pac at log-off are discarded, i.e. they become instant garbage, which is harmless.

This excessive disk activity on the first transaction can be avoided by a pac initialization transaction after log-on and before the first big application transaction, in order to grow the pac within the scope of one transaction flush instead of 10000 flushes, like this:

  | vom customers departments |
  [ vom := VOManager newForExistingSpace: ‘c:\vospaces\myspace’.
    vom isNil ifTrue: [^self].
    vom open ifFalse: [^self].
    vom cacheMaxSize: 11000.
    vom storageManager pacSize: 10000 “set required pac size”.
    [Array newVirtualIn: vom] atomic. “dummy transaction to trigger pac growth”

    [ customers := vom rootDictionary at: ‘customers’.
      departments := vom rootDictionary at: ‘departments’
    ] atomicReadOnly.
    …
    …
    …
  ] forkAt: (Processor userBackgroundPriority).

Thu 20th Dec 2007   12:12 PM
posted by John Clapperton

Q:  “What is the rootDictionary of a virtual space, and should all object accesses go through it?”

A:  The rootDictionary is a VirtualDictionary created automatically when a virtual space is created, and is the only object immediately accessible by an image after log-on, it is returned by the message VOManager>>rootDictionary.

In principle (though unusually) there could be several completely independent databases in one virtual space, so each database should be anchored in the rootDictionary using a VirtualDictionary to hold the root objects of the database, which are typically the main VirtualDictionarySets of domain objects requiring multi-key access, e.g. Customers, Departments etc. On startup, the application should get these root objects and assign them to instance variables (e.g. ‘customers’ ‘departments’) in some static object in the application so that they are directly accessible to the application, to avoid the rootDictionary becoming a bottleneck for concurrent transactions.

 
cancer treatment effects of celexa buy proscar real levitra online online cialis no prescription buy cialis where luvox cr cialis online without prescription rx-viagra chewable cialis buy levitra onlines cialis 10 online allegra effects of high blood pressure buy alpha lipoic acid phentermine no perscription medician for heart attacks chlamydia medication dosage alternative cholesterol treatment buy lasuna natural constipation remedies nitroglycerin sublingual site viagra treatment of heart attacks seroquel for depression buy cialis how to boost immune system healthy pets cialis alcohol buy canada levitra scabies medicine cheapest cialis price buy pain medicine on-line immune system support products cats hairball low prices pain meds alcoholism treatment option new treatment for depression buy tribulus discount vitamin vitamin a natural arthritis cures chlamydia antibiotics viagra prescription lisinopril 10mg celecoxib medicine ultram buy discount cialis famvir dose buspar viagra online usa herbal antifungal and antibacterial buy viagra hypnosis to stop smoking buy discount cialis depakote 250mg buy lipothin viagra to buy how to take a beta-blocker buy cialis without prescription diazepam 10 mg what causes hair loss in women buy cheap cialis without a prescription cheap cialis tadalafil generic viagra on line menopause treatment zantac medication dog tooth infection cialis 30 effexor dose buy glucosamine sulfate metoprolol dose diet hoodia gum side effects levitra cialis on line stomach parasites viagra online cheap breast increasing oils buy paxil online online cheap viagra buy buy viagra order viagra cialis 5 aspirin medicine at home acne treatment canada cialis generic buy mycelex treatment of stroke order viagra plus zyprexa 5mg buy diazepam approved cialis fda itching relief viagra online usa hair loss treatment online information on levitra immune system supplement how to buy viagra beta blocker uses adhd treatment buy online viagra buy cialis online in usa adhd in women cats inflammatory bowel disease cialis viagra valtrex dosage cheap breast augmentation buy cialis online with a prescription prescription ibuprofen healthy women's vitamins dog site health treatment for lung cancer cialis without a prescription cialis 5mg cheap order viagra online discount viagra online order celebrex hypnotherapy for health synthroid doses hypothyroidism medication discount cialis online cialis 50mg help for infertility top ten acne products buy pain killers reducing cholesterol naturally viagra tablet dosage zoloft viagra cialis cialis comparison online stores hair loss products medications ativan lowering blood pressure naturally fluconazole cialis 20 mg buy augmentin buy cialis online cold flu menopause gum online pharmacy viagra buy cymbalta fluconazole capsule jelly kamagra brand viagra online cialis prescription online cialis without rx irritable bowel syndrome cures zestril medication cheapest online cialis buy celebrex online buy viagra on line