I want to develop CDI application in Glassfish 3.1.2 using OSGI and CDI. But I don’t know what is the performance penalty in CDI applications. Can I use CDI in multithreaded applications? Can I pass large data structures using CDI?
Best Wishes
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is a performance penalty for using CDI, but in almost all cases where we deploy to glassfish it is negligible compared to everything else that is going on. Unless you specifically know/suspect that the CDI part of the code is where the application will spend most of its time I wouldn’t have any second thoughts about using CDI. Our world is overcrowded with premature optimizations when we all know that optimization is done: When there is a problem, not when writing code. And done by profiling to find spots to optimize, and then optimizing thoose spots. The coding and maintainace time saved by using CDI should almost always outweigh the time it costs to revert to another technology if the need ever appear.