Saturday, December 29, 2007

net start yourservice and you receive: Error 1083?

it can have many issues, but one of them - like mine, was that i had the base class: ServiceBase in a different Assembly (dll). Once I moved them to the Windows Service Project everything runs well :-)

My Error was like:

Error 1083: The executable program that this service is configured to run in does not
implement the service.


with the small change everything was fixed.

Thursday, December 27, 2007

Hardest game ever?

take yourself the 8 min to watch this: http://www.snotr.com/video/774

A very frustrating Japanese Mario-like game!!

Wednesday, December 26, 2007

indeXus.Net Shared Cache V1 is available

I finally have released the first version of indeXus.Net Shared Cache which is available at: http://www.sharedcache.com/.

indeXus.Net SharedCache is a high-performance, distributed caching system. Although application-neutral, it's commonly used to speed up dynamic Web applications by alleviating database load.

indeXus.Net SharedCache runs as a distributed windows service on every web and / or application server farm to cache data objects in memory out of process. Your stored objects can be accessed from any of your servers in your farm. It would be great if you help me to make it public through usage and blog entries. The release notes are available at the following location: https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=SharedCache&ReleaseId=9424

for any queries about sharedcache please use the following email:
sharedcache [AT] indeXus [DOT] Net

Saturday, December 22, 2007

a simple und strightforward way to sort generic List

Sorting in general with generic list is quite easy if the developer knows how to do the sorting. With simple anonymous methods, as well the little known Comparsion delegate.

In one of my previous posts (caching cleanup strategy) I described a specific problem I have to solve for SharedCache, the .Net caching solution for distributed cache: http://www.sharedcache.com/ / http://www.codeplex.com/SharedCache

The following example here is just partly, the full code will be available within a few day's on CodePlex - upon my next hugh checkin .... people i'm a bit afraid to check it in sometimes it has so many new features ;-) - that i say as a person which preferres the way of: make small steps your reach your target faster!!!!

a simple sample class (a full formatted working class sample from my project):

   1:      public class Cleanup : IComparable<Cleanup>
   2:      {
   3:          string yourProperty = string.Empty;
   4:          public enum SortingOrder
   5:          {
   6:              /// <summary>
   7:              /// ascending sorting order
   8:              /// </summary>
   9:              Asc,
  10:              /// <summary>
  11:              /// descending sorting order
  12:              /// </summary>
  13:              Desc
  14:          }
  15:          public int CompareTo(Cleanup other)
  16:          {
  17:              return this.yourProperty.CompareTo(other.yourProperty);
  18:          }
  19:          public static Comparison<Cleanup> CacheItemPriority =
  20:              delegate(Cleanup cu1, Cleanup cu2)
  21:              {
  22:                  if (Cleanup.Sorting == SortingOrder.Asc)
  23:                  {
  24:                      return cu1.yourProperty.CompareTo(cu2.yourProperty);
  25:                  }
  26:                  else
  27:                  {
  28:                      return cu2.yourProperty.CompareTo(cu1.yourProperty);
  29:                  }
  30:              };
  31:      }
Once you have defined your class, you are able to sort it like need, with Ascending and Descending sortings
the sample you find also formatted at here: http://www.ronischuetz.com/code/cachecleanup.html
   1:      public class CacheCleanup
   2:      {
   3:          public CacheCleanup()
   4:          { 
   5:              List<Cleanup> coll = new List<Cleanup>();
   6:              coll.Add(new Cleanup(IndexusMessage.CacheItemPriority.Normal, new TimeSpan(0, 1, 7), 1, new DateTime(2007, 12, 28, 14, 12, 12), 21232, 90));
   7:              coll.Add(new Cleanup(IndexusMessage.CacheItemPriority.AboveNormal, new TimeSpan(0, 15, 7), 2, new DateTime(2007, 12, 28, 14, 12, 14), 22232, 190));
   8:              coll.Add(new Cleanup(IndexusMessage.CacheItemPriority.BelowNormal, new TimeSpan(0, 18, 7), 3, new DateTime(2007, 12, 28, 14, 12, 40), 23232, 88));
   9:              coll.Add(new Cleanup(IndexusMessage.CacheItemPriority.High, new TimeSpan(0, 8, 7), 4, new DateTime(2007, 12, 28, 14, 12, 16), 21552, 22));
  10:              coll.Add(new Cleanup(IndexusMessage.CacheItemPriority.Low, new TimeSpan(0, 9, 7), 5, new DateTime(2007, 12, 28, 14, 12, 17), 21252, 1));
  11:              coll.Add(new Cleanup(IndexusMessage.CacheItemPriority.NotRemovable, new TimeSpan(0, 22, 7), 6, new DateTime(2007, 12, 28, 14, 12, 19), 212332, 5));
  12:              coll.Add(new Cleanup(IndexusMessage.CacheItemPriority.AboveNormal, new TimeSpan(0, 41, 7), 7, new DateTime(2007, 12, 28, 14, 12, 22), 211232, 55));
  13:              coll.Add(new Cleanup(IndexusMessage.CacheItemPriority.BelowNormal, new TimeSpan(0, 58, 7), 8, new DateTime(2007, 12, 28, 14, 12, 21), 22532, 25));
  14:   
  15:              Console.WriteLine(@"Without Sorting");
  16:              foreach (Cleanup c in coll)
  17:              {
  18:                  Console.WriteLine(c.ToString());
  19:              }
  20:   
  21:              Cleanup.Sorting = Cleanup.SortingOrder.Asc;
  22:              coll.Sort(Cleanup.CacheItemPriority);
  23:              Console.WriteLine(@"Normal Sorting");
  24:              foreach (Cleanup c in coll)
  25:              {
  26:                  Console.WriteLine(c.ToString());
  27:              }
  28:   
  29:              Cleanup.Sorting = Cleanup.SortingOrder.Desc;
  30:              coll.Sort(Cleanup.CacheItemPriority);
  31:              Console.WriteLine(@"Reverse Sorting");
  32:              foreach (Cleanup c in coll)
  33:              {
  34:                  Console.WriteLine(c.ToString());
  35:              }
  36:          }
  37:      }

it's couldn't be easier :-)

Thursday, December 20, 2007

caching cleanup strategy

As many of the blog readers know, I develop in my spare time a .net caching component which is available under: http://www.sharedcache.com or http://www.codeplex.com/sharedcache. This component aims to be a high-performance, distributed memory object caching system, generic in nature, but intended to speeding up dynamic web and / or win applications by alleviating database load.

now since some different websites are using the cache (thanks for all your feedback's and inputs) the issue comes up to selectively purges items to free system memory.

Here are some options which I would love to hear your feedback's about them and about what you would need for your personal usage:

  • CacheItemPriority: A new option will be created where objects which are added to the cache receives a priority attribute.
  • LRU: Least Recent Used: The objects with the oldest requests will be deleted- LFU: Least Frequently Used: Means the object's witch are used less will be deleted from the cache / if all objects are used in same frequency the objects will be used in a randomized order
  • Pitkow/Recker: Like LRU, but if they used on same day they will not be deleted
  • Timebased: The objects with the smallest time left in the cache will be deleted, in case all objects are used with max time, they will be deleted randomized
  • SIZE: Delete always biggest objects until it received the size of FillFactor
  • Lowest-Latency-First: Delete smallest objects until configured FillFactor reached. in the app settings the customer will be able to define his cleaning strategy type as a key.
  • Hybrid: Makes a combination between several parameters: TimeTaken, Amount of Requests, Size, Cache Life Timeeach parameter receives a number between 1 - n and those with the highest / lowest numbers will be deleted until configured FillFactory reached.

I would love to receive your feedback's and inputs about it.

Tuesday, December 18, 2007

Hashtable != Dictionary

A Dictionary is closely related to a HashTable. There are many subtle differences between them, but one important difference is that a Dictionary is generally faster than a Hashtable for storing data. The reason is that a Dictionary takes strongly-typed values as its input, so you do not suffer the performance impact of storing generic Objects and boxing/unboxing them into the proper types during use.

this has been copied from the following link: http://www.kirupa.com/net/dictionary_hashtable.htm

thanks to the author for sharing this great article!

Friday, December 14, 2007

Oracle Performance - Part 3

Enterprise Manager (and / or GridView)

Pro:

  • Great tool for developers and dba's
  • very easy to use to prevent of hint-sytaxt failers
  • makes easy usage of init.ora tuning parameters

Contra:

  • within the execution plan only expected rows are displayed

Oracle Performance - Part 2

Data-Dictonary / Tables / Views and more

  • v$ - Views are like "Dynamic Performance Views"
  • Not all of them are relevant for tuning
  • they are a part of the SYS

Checkout the Oracle ref. books, within the Database Performance Guide and reference book, they describe the most important views

Measuring:

Usually you measure CPU, Elapsed Time, I/O und access at the SGA

Possibilities for analyses:

  • statspack
  • dv-review / tuning package
  • enterprise manager

  1. Instance information are retrived from: SELECT * FROM V$SYSSTAT
  2. Session information are retrived from: SELECT * FROM V$SESSTAT
  3. My sessions information is retrived from: SELECT * FROM V$MYSTAT
  4. Events are retrieved from : SELECT * FROM V$EVENT_NAME

Examples:

  1. SELECT n.name statsitic, st.VALUE, se.username from v$sesstat st, v$statname n, v$session se WHERE st.statistic#=n.statistic# and st.sid = se.sid and se.username=''your_username'
  2. Wait - Statistics -> SELECT * FROM v$waitstat;
  3. Show the wait of your actuall session: SELECT sid, event, p1text, p1, p2text, p2, seconds_in_wait sek , state from v$session_wait where sid=YOUR_ID

Possibles values for the value state:

  • WAITING - session is waiting
  • WAITED UNKNOWN TIME - duration of waiting is unknown (TIMED_STATISTICS)
  • WAITED SHORT TIME - last wait was lower then 0.01 sec.
  • WAITED KNOWN TIME - duration of last wait

extension for the V$SESSION_WAIT -> V$ACTIVE_SESSION_HISTORY

it display the history of your session, and some new col. are displayed which are making life easier to identify BLOCKING_SESSION, BLOKING_SESSION_SERIAL and some more specific data.

the above described views are a part of the diagnostic pack. before you gone use them, please check your license pack there are some hints! oracle is getting warster then MS, they even deliver everything and install it directly but you're not allowed to use it... so check your lic. package.

Oracle Performance

Performance != Performance

Parameter tuning is one of the more important issues - inti.ora / spfile.ora but dont forget its just a part of it and should not be weight to heavy. Instance tuning is mostly just between 10% - 20% of it.

do not forget about all the other parts:

  • Datamodel
  • correct indexing
  • sql optimizing
  • application optimizing - which is in 90% of the cases the issue
  • operating system / hard ware optimizing (CPU's, RAM, DISC's, Network)
  • usage of actuall versions

how to start:

one of the most important issues do it slowly and step by step. Many times it easier to identify if you change one parameter at the time instead of several together. The worst case, you never know which change have done the work in the end.

Define yourself a clear defined target, its 50% of the work when you can reach your targets. Measuring is not less important, otherwise you have no idea how to compare, right?

Make yourself cycles:

  1. tune business rules
  2. tune data design
  3. tune application design
  4. tune logical structure
  5. tune database operations
  6. tune access path
  7. tune memory allocations
  8. tune I/O and physically structure
  9. tune resource constention
  10. tune underlyding platforms

Many times its not a single job, you will have to contact developers / DBA / System Managers / Management / Network People etc., all of them can be a decision maker within changes you need to make - create yourself a plan and check it toghether with all different departments.

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge