|
RESTful web services use the HTTP protocol to denote if a method is idempotent or safe by using either HTTP POST or GET to communicate with the endpoints.
Thinking about general distributed applications and load balancing, wouldn't it be interesting to denote classes and/or methods as being safe or idempotent as well? In .NET, one could easily introduce the attributes like [Safeness(Safeness.Safe)] and [Safeness(Safeness.Idempotent)] for example.
Tagging methods this way would allow us to build a load balancing layer which could react more dynamically because it's not only working at the protocol level but instead on a level which can actually determine the application's needs more closely. It could for example retry idempotent methods automatically on failure. It could also allow a methodcall to carry a priority flag and if this priority flag is set to critical it could simply dispatch calls to methods tagged as safe to all known servers and take the first response.
When thinking longer about it, I guess I could come up with even more usage scenarios ...
Any comments or further ideas? Does any development platform or programming language actually support these notations right now?
|