Ajay Kamble wrote:So do you mean that filter does not affect performance?
Not necessarily.
As David said, it depends on what your filter is doing.
If the code in your filter does something expensive (like created database connections to read large amounts of data) then, yes it will slow things down.
If you're asking if filters in and of themselves cause a big hit to performance, no.
It wouldn't be hard to
test.
Create a simple hello world app (or download one
here), hit it a couple times to see how fast it responds.
A tool like firebug will show you response times for requests.
Then add a filter and hit it some more.
Keep adding filters and keep hitting it. You'll know for certain, exactly how much of a performance hit a filter causes.
Another test that will give you some perspective would be to take a hello world servlet and throw a RuntimeException in it.
Then look at the stack trace in the logs. When you see how many components a typical requests goes through you'll realize that one more is fairly trivial.