So spent a few weeks playing with wcf 4 and both windows and iis hosting, i have a nice lite config pattern making some use of wcf 4's configurationless features and extending it all to make use of code defined settings.
I have to say i like the use of the new proxy and host changes, made getting a clean pattern together nice and easy (I have found the default bindings rarely provide sufficient control within an enterprise environment).
IIS osting for straight services works best with http bindings, WAS supports the use of TCP, and although more reliable than msmq, its still messy to get working properly (im not and have no intention of being an iis expert). and why use tcp over http really, you can fully configure binary transmission, and security in http, in addition to ssl and lets not forget IIS ARR routing (love shared config and ARR load balancing).
msmq is a bit different, played in iis and got it working. even put a service pattern in place that allowed the use of arr, but fiddly, messy and unreliable, which brings me on to a point...
MSMQ is all about safety, I see a lot of posts about how to get high performance out of msmq, and why, if you need performance use tcp or http services. msmq is about getting a message from a to b with high reliability, so who cares if it takes a couple of seconds longer (i will reject any code i review that doesn't use durable messages). Throttling is a great idea, allows you to control load easily, and prioritising is an anti pattern, there is a chance a low priority message will never get processed so why would you take the chance. So best bet is wcf with net msmq binding, hopsted as a windows service (your boxes should always be active passive at the very least). if your msmq architecture is overloading your boxes, split yp the services on to different boxes, reduce throttling caps otherwise your architecture is wrong.
Sunday, 22 August 2010
Friday, 20 August 2010
Object Relational Mapper
I use orm's quite extensively (mainly nHibernate and Llblgen) at work, and had been thinking about writing my own lightweight orm for many many months, and made a few attempts, none of which got fully completed, until last April, when during a week off i finally sat down collected all my ideas got rid of the complicated one's and wrote it.
I eventually went with a pure explicit engine, i have played (original 2 or 3 versions) with implicit, but after spending a great deal of time with nHibernate, honestly i have come to dislike and distrust implicit engines. I would prefer to say when i want an update, and when i request data, go back to the database to get it. Database developers (Ms, oracle or whoever) have spent more time than i ever could in optimising the query engines, so why on earth do i think i can do better? answer i can't, additionally if the engine decides when and what to write to the db as it feels like it there is risk it will get it wrong, and whats the point of persistance with that kind of risk.
Now i have a small amount of implicity in that it supports cascade (too useful to ignor) but i have restricted it a little, firstly if saving (insert or update) it will never delete, (otehrwise you have to track what queries the objects relate to etc) and it will check the record in the database if it needs to. Delete requests also cascade, and do delete, but only dependancies (i.e. if foreign keys to objects your deleting and fk column is not nullable the record is deleted). Finally at the point of calling write requests i have a cascade tree you can define, so you can specify exactly how deep to cascade if at all.
So why post about it now? well although i have been very happy with it, and my query engine is ok, i think it could be better, starting playing with a fluent Linq Expression qurery engine, my initial findins suggest i should be able to parse the expression nicely to fit in with the core engine, and would be a much nicer .net front end, I'll post my results when i actually get round to it (i have this next week off so may start it in a couple of days).
I eventually went with a pure explicit engine, i have played (original 2 or 3 versions) with implicit, but after spending a great deal of time with nHibernate, honestly i have come to dislike and distrust implicit engines. I would prefer to say when i want an update, and when i request data, go back to the database to get it. Database developers (Ms, oracle or whoever) have spent more time than i ever could in optimising the query engines, so why on earth do i think i can do better? answer i can't, additionally if the engine decides when and what to write to the db as it feels like it there is risk it will get it wrong, and whats the point of persistance with that kind of risk.
Now i have a small amount of implicity in that it supports cascade (too useful to ignor) but i have restricted it a little, firstly if saving (insert or update) it will never delete, (otehrwise you have to track what queries the objects relate to etc) and it will check the record in the database if it needs to. Delete requests also cascade, and do delete, but only dependancies (i.e. if foreign keys to objects your deleting and fk column is not nullable the record is deleted). Finally at the point of calling write requests i have a cascade tree you can define, so you can specify exactly how deep to cascade if at all.
So why post about it now? well although i have been very happy with it, and my query engine is ok, i think it could be better, starting playing with a fluent Linq Expression qurery engine, my initial findins suggest i should be able to parse the expression
Working WCF Peer Mesh Code
I've had a few requests for the working source code for the wcf peer mesh, those of you that have asked will be happy to hear i finally got around to digging out the code and cleaning it up a little, I have hosted on my new Open Source SVN Repository
http://svn2.xp-dev.com/svn/smpPeerMesh/trunk/PeerResolver1.0/
anyone who doesn't use svn can email me, and i'll zip up the files and send them out to you.
I've build this in VS 2010, but its .net 3.5 so should open in 2008 without any problems (again if problems give me a shout and i will rebuild in 08).
Hope its of some help, I have implemented this in a production environment to provide a wpf ui with live updates on a background worker thread.
To cover myself... I take no responsibilty for the use of this code or code written on the back of it.
http://svn2.xp-dev.com/svn/smpPeerMesh/trunk/PeerResolver1.0/
anyone who doesn't use svn can email me, and i'll zip up the files and send them out to you.
I've build this in VS 2010, but its .net 3.5 so should open in 2008 without any problems (again if problems give me a shout and i will rebuild in 08).
Hope its of some help, I have implemented this in a production environment to provide a wpf ui with live updates on a background worker thread.
To cover myself... I take no responsibilty for the use of this code or code written on the back of it.
Subscribe to:
Posts (Atom)