WCF - Webhttpbinding, see significant difference between PerCall and PerSession

917 Views Asked by At

I have tried to configure my wcf webhttpbinding (restful) service both PerSession and PerCall.

As far as I understand webhttpbinding does NOT use sessions to satisfy the restful principles, however I see significant performance differences when putting load on my service from LoadUI.

Shouldn't Persession and PerCall act the same way, since for every call a new Service Instance is created, because there are no sessions in webhttpbinding.

1

There are 1 best solutions below

0
On BEST ANSWER

The REST services architecture is stateless see (REST WS) so it makes no sense to have the a rest service with

InstanceContextMode = PerSession.

The performance improvement using PerSession (however concurrency issues may appear) is for SOAP web-services.

Answering your question I believe that is a fortunate series of events (db connection pooling, database cache, etc) that you see a performance improvement.

As InstanceContextMode.PerCall is the stateless mode for WCF it is also instantiation mode of your rest service, even if you specified the PerSession as InstanceContextMode.