Brian McGarvie | Find out more information on Brian M McGarvie and his IT consultancy, and personal adventures and experiences…

Archive for August 2007

Recently we have had the pleasure of dinning at Gordon Ramsay at Claridges Hotel in London.

There were 4 of us dining, Laura, my parents and I.

We started the evening in Claridges off with a cocktail or 2 in the lobby/lounge. Now being Claridges you expect it to be posh, but by having this expectation it was just as I envisaged… it was posh, but in a subtle and relaxed way. The cocktails are very nice… and considering the venue I think reasonably priced – I enjoyed my pre-meal Singapore Sling and the others had a simple G&T. The nibbles provided were a good indication of things to come… they were simple but elegant and one (the toasted cheese) unusual but turned into my favorite very quickly!

We moved through into the dining room and it was again tastefully decorated, and not oppressive as it can be in some other similar establishments. The general atmosphere was calming and the lighting was subtle but still enough to see the plates!

Before our starters arrived we were given a plate of canapés – which were delicious, there was a selection of bite-sized spring rolls, fish cakes and breads. We were then given a tomato and cucmber soup drizzled with olive oil – very refreshing and cleansing before our meal.
For our starters 3 of us had the Fois Gras, one was a Mosaic of foie gras and Goosnargh duck with Red Pippin apple and walnut salad, toasted brioche and the other was more traditional – Roasted duck foie gras with macerated cherries, pickled ginger, cauliflower and almond cream (I had this, but there were nicer things on the menu which I would have enjoyed more, but it was still very very nice!), and Laura’s starter was Ravioli of Dorset blue lobster and salmon poached in a lemongrass bisque, basil vinaigrette.

For mains, Laura had the Pan-fried Mediterranean stonebass with Cromer crab and celeriac cannelloni, summer vegetable blanquette, lemon thyme velouté which was delicious, my Mum had a steak (not very adventurous, but it was a very nice piece of meat!) while my Dad and I both had the Roasted John Dory and sautéed langoustines with violet artichokes, pink fir potatoes, carrot purée and a light fennel cream. I was very happy with my main – however I am probably being greedy and think there could have been another bit of fish and one more langoustine. Laura was delighted with her meal and portion wise was ample. My Mum & Dad both also enjoyed their respective meals.

After this we were given a peach soup with rasperry sorbet mouse then it was onto desert, Laura and I both had the passion fruit creme brule – it was divine, my mum had a hot chocolate sponge while my dad opted for the huge selection of cheese from their trolley – the wedged returned to him were ample too!

The wine list was like vast and ranged from £23 per bottle to over £2,000!!!

In summary, the food was very well presented, portions good (but on the edge of small) but it was quality not quantaty. Will we return? Probably! But it would generally be for a special occasion, and we’d also plunge for a room at £300+ for the night too – you might as well go the whole hog! The staff were second to none, very friendly, happy to talk and treat you with class…

My Rating (each out of 10):
Food 9 | Service 10 | Atmosphere 9 | Value for money 8 | Overall 9

, , , Hide

Aug/07

30

ColdFusion Caching Explained

Configured in the ColdFusion administrator under the “Caching” section, server caching controls how much and when data is stored in memory. An effective server caching strategy can relieve stress on resources such as databases, CPUs, and file systems while dramatically improving application performance. This article explores server caching in ColdFusion, introducing its different pieces and providing examples of how server caching works and its benefits.

Template Cache

All ColdFusion templates are compiled into PCode before execution. This compilation process can be resource intensive and slow down an application. To avoid compiling a template on every request, ColdFusion caches its PCode into memory the first time that it is called. If the cache becomes full, the cache is forced to purge templates on a first in first out basis to accommodate new requests. As a result, the next time the purged template is called, it must be recompiled. This purging is referred to as a cache pop and can be seen when monitoring CFSTAT.

If ever CP/Sec is greater than 0, Allaire recommends that the “Template Cache Size” setting be increased. By default “Template Cache Size” is set to 1024 kilobytes, but a good rule of thumb is to set the template cache size two to five times the total template size. Note that this setting is a maximum limit and is not allocated until necessary. Each template is cached only once, even if it is included in several other templates.

Trusted Cache

Though a template’s PCode may be stored in the template cache, ColdFusion checks the actual file to see if it has been modified after it was cached. This check may increase I/O wait and can be avoided by turning on trusted cache, also in the ColdFusion administrator.

With trusted cache enabled, ColdFusion will only access the template cache—even if the template itself is modified. This can be problematic if developers expect to see changes when files are modified. To introduce modified templates into the cache with out restarting the ColdFusion server, disable trusted cache and make a request to each modified template. Trusted cache can then be turned back on.

Database Connection Caching

To avoid the highly expensive task of opening and closing a connection to the database for every request, ColdFusion caches database connections by default. This means that the connection to the database is only opened once for many requests, thereby dramatically improving performance.

If you are connecting to a clustered database configuration, it may be necessary to disable connection caching to allow failover to function properly. This can be accomplished by unchecking “Maintain Database Connections” in the attributes of the data source but will strongly degrade performance.

To avoid unused connections to the database remaining open for long periods of time, the “Limit cached database connection inactive time” setting can be adjusted. It is also possible to manually release all data source connections from the “Verify Data Source” section of the ColdFusion administrator.

Query Caching

Query caching greatly increases performance as result sets are retrieved from memory rather than from the database. Developers should consider caching queries whenever possible.

For example, the following query will be cached for two hours:

<CFQUERY Name="MyQuery" DataSource="dsn"
CachedWithin="#CreateTimeSpan(0,2,0,0)#">
Select * from Inventory where InventoryId =2
</CFQUERY>

While caching queries is controlled by code, the limit of allowable cached queries is set in the ColdFusion administrator. With the introduction of CF 4.5x, it became possible to cache more that 100 queries at a time. The amount of queries that can be cached is now limited only by the amount of memory available on the server. As the size of result sets, amount of available memory, and the use of cached queries in applications vary, this setting should be tested under expected load for optimal performance.

Improving scalability is about finding and removing bottlenecks that restrict the growth of a system. The most common bottlenecks for Web systems include:

  • Insufficient network bandwidth.
  • Insufficient CPU resources.
  • Inability to get data to/from the database.
  • Solving each problem seems simple:
    • Call the ISP.
    • Add servers.
    • Add more database server(s).
    • Decrease the time between a page request and the page view.
    • Reduce the amount of work generated for the database server for each page view.
    • There is a limit to the number of queries you can cache. This number is configured in the ColdFusion Administrator under”Caching.” In ColdFusion 4.01, you cannot set this number higher than 100. This limitation was removed in ColdFusion 4.5, but that is not an invitation to set the value to 30,000. Caching too many result sets will cause memory starvation and heavy virtual memory paging, negating the benefits.
    • If you have a dynamic query, such as “SELECT * FROM Catalog WHERE CatalogNumber = #val(FORM.CatalogNumber)#”, each permutation of that query counts as one cached query. Therefore, query caching should only be used for commonly accessed result sets. The CFML Language Reference defines a distinct result set by stating “…the current query must use the same SQL statement, data source, query name, user name, password, and DBTYPE. Additionally, for native drivers it must have the same DBSERVER and DBNAME (Sybase only).”
    • There is no easy way to invalidate a result set, if you detect that a result set should be invalidated. Therefore, the time span used for the result set cache should be chosen carefully. However, if you have a result set that is accessed four times per second, setting a timeout as low as a minute reduces the load on the database (for that query) by a factor of 240.
    • You cannot use query caching for parameterized queries (queries using <CFQUERYPARAM>.) Parameterized queries should be used for common non-cached queries, since they allow the query plan to be reused on some database systems (such as Oracle), and they are virtually immune to malicious query editing as documented in Allaire Security Bulletin ASB99-04 (http://www.allaire.com/handlers/index.cfm?ID=8728&Method=Full)
  • Unfortunately, the cost of adding database server(s), both in terms of money and administrative overhead, is very high. So, it seems that maximizing your existing investment in database hardware and software is warranted. Enter query caching.

    Query caching is designed to accomplish two goals:

    Implementing query caching is very simple. For example, examine the query below, which might be used to retrieve a list of states for a <SELECT> list.

    Before:
    <CFQUERY Name="qStates" DataSource="#Request.DSN#">
    SELECT StateCode
    FROM States
    ORDER BY StateCode
    </CFQUERY>

    After:
    <CFQUERY Name="qStates" DataSource="#Request.DSN#"
    CachedWithin="#CreateTimeSpan(0,1,0,0)#">
    SELECT StateCode
    FROM States
    ORDER BY StateCode
    </CFQUERY>

    You just empowered ColdFusion to hold on to the results of that query for up to an hour. ColdFusion will now stop repeatedly asking the database for the results of this query. In fact, ColdFusion will reuse the results of that query for up to an hour before asking the database for that result set again. The database is now relieved of the duty of fetching these rows and sorting them (which usually involves creating and dropping a temporary table) for each request to that page.

    Before you get too excited, there are a few details to consider:

    Keep in mind that queries are also global to the server, so if you use the same query with the same name in multiple pages, that cached result set is shared between the pages.

    The repetitive nature of Web pages often causes database servers to work very hard at producing the same results sets over and over again. However, by using the Query Caching capability included with ColdFusion, a significant amount of work can easily be moved from the database server to the ColdFusion servers. This allows for a much higher ratio of ColdFusion servers to database servers, enhances the performance and scalability of your Web system, and maximizes your investment in your database servers.

    When designing a server caching strategy, it is important to take into account available sever memory and the need for fully dynamic information. If poor application performance is an issue, these settings may make a world of difference. During implementation, testing should take place to ensure that the application and server reacts as expected. Be sure to monitor server memory and verify that application data is correct.

    Note: this article was created as a result of some research and training courses I have been on and recommendations from them. This article is likely to evolve :)

, Hide

Aug/07

23

SQL – Select using current day…

I’ve had this problem a few times, and many people always ask me it… so here it is immortalised.

If you require to select all records added to your table for the current day use the following where clause – obviously ‘col’ should be the name of your datetime column…

Hope this helps you all as much as it has myself!
select *
from mytable
where datediff(day,getdate(),col)=0 and col <= getdate()

, , Hide

Aug/07

22

Pad Thai

I have been experimenting for a while now making Pad Thai, from jars to trying to analyse the take-away carton from my excellent local Thai resteraunt.

Sadly i have not yet been able to visit Thai land, but parts of the following have been given to me by friends who have and sampled some of the varied street-food you get there.

Firstly, you will never see the red and oily pad thai in Thailand that is common in many western Thai restaurants. And this is where I was personally going wrong in trying to re-create this type.
A great Pad Thai is dry and light bodied, with a fresh, complex, balanced flavor.

Also, Pad Thai can be a perfect vegetarian dish, just skip the shrimp and use soy sauce instead of the fish sauce. Add (more ) tofu if you like.

2-3 Servings


a

1/2 lime
1 egg
4 teaspoons fish sauce
3 cloves garlic, minced
1/2 teaspoon ground dried chili pepper
ground pepper
1 shallot, minced
2 tablespoon sugar
2 tablespoon tamarind
1/2 package thai rice noodles
2 tablespoon vegetable oil
1/2-1/4 lb shrimp Optional
1/2 banana flower Optional
1/3 cup tofu – extra firm Optional
1-1/2 cup chinese chives – green Optional
2 tablespoons peanuts Optional
1-1/3 cup bean sprouts Optional
1 tablespoon preserved turnip Optional
Tips and substitutions

By far, the trickiest part is the soaked noodles. Noodles should be somewhat flexible and solid, not completely expanded and soft. When in doubt, undersoak. You can always add more water in the pan, but you can’t take it out.

Shrimp can be substituted or omitted.

In this recipe, pre-ground pepper, particularly pre-ground white pepper is better than fresh ground pepper. For kids, omit the gound dried chilli pepper.

Tamarind adds some flavor and acidity, but you can substitute white vinegar.

The type of extra firm tofu called for this recipe can be found at most oriental groceries in a plastic bag, not in water. Some might be brown from soy sauce, but some white ones are also available. Pick whatever you like.

If you decided to include banana flower, cut lengthwise into sections (like orange sections). Rub any open cut with lime or lemon juice to prevent it from turning dark.

The original Pad Thai recipe calls for crushed roasted peanuts. Many people in Thailand avoid eating peanuts because of its link to cancer.

Soak the dry noodles in lukewarm water while preparing the other ingredients, for 5-10 minutes. Julienne tofu and cut into 1 inch long matchsticks. When cut, the extra firm tofu should have a mozzarella cheese consistency. Cut up Chinese chives into 1 inch long pieces. Set aside a few fresh chives for a garnish. Rinse the bean sprouts and save half for serving fresh. Mince shallot and garlic together.

Use a wok. If you do not have a wok, any big pot will do. Heat it up on high heat and pour oil in the wok. Fry the peanuts until toasted and remove them from the wok. Add shallot, garlic and tofu and stir them until they start to brown. The noodles should be flexible but not expanded at this point. Drain the noodles and add to the wok. Stir quickly to keep things from sticking. Add tamarind, sugar, fish sauce, chili pepper and preserved turnip. Stir. The heat should remain high. If your wok is not hot enough, you will see a lot of juice in the wok at this point. Turn up the heat, if it is the case. Make room for the egg by pushing all noodles to the side of the wok. Crack the egg onto the wok and scramble it until it is almost all cooked. Fold the egg into the noodles. Add shrimp and stir. Add bean sprouts, chives. Stir a few more times. The noodles should be soft and very tangled.

Pour onto the serving plate and sprinkle with peanuts. Serve hot with the banana flower slice and a wedge of lime on the side and raw Chinese chives and raw bean sprouts on top.

, , Hide

Get Adobe Flash playerPlugin by wpburn.com wordpress themes

Find it!

Tags