I have seen in weblogic admin console the same datasource with multiple JNDI names
These JNDI names are then referred in different applications
So my understanding is - the same datasource is being used by different applications deployed
Now my question is - lets say one application leaks jdbc connections ( does not close connections - so they never get returned back to the pool ) - will the other applications get impacted in this case ?
or will the server create separate connection pools for each application ?
Thanks
satish
All applications will share the same connections from the pool, so one application that leaks connections will affect the other applications as well. Each application does not get its own pool unless you create a separate datasource with a different JNDI name.
Related
We have planned to migrate our application to web role as web role splits the server traffics to other instances. We have some queries regarding that . Let me post it one by one.
1) Since web role involves multiple instances (redirecting to different servers at run time based on the number of instances created), what happens to my session related details which was maintained in one server (with inproc mode will get resides in iis ) when my next requests gets redirected to other server where my session related details wont be available know? Do the windows azure takes a copy of that too or do we need to manully handle?
2)Our application works like Presentation Layer makes a call to the web service which in turn queries the database and results are displayed accordingly (presentation -> webservice -> database). So when am making my presenataion layer as cloud service web role obvioulsy i would need to make my service also as a web role . Am i right?
2.1) If so, what happens when am making the request from presentation how the requests will get carried ?
2.2) Am having my database in a separated vm (not azure db) hosted in sql express when the service dynamically
creates multiple instances what happens to database part?
2.3) Shall we host service and presenation in same cloud service or different which will be preferrable one?
I have a application that has been programmed with MVC/EF Code First. It does a lot of server side processing and is pretty resource intensive.
I know how to set up load balancing, but, I want to know if scaling an EF application is as simple as provisioning a new server, deploying the application and pointing to the DB cluster - or are there any issues I will face with regards to multiple EF applications hitting the same database server?
I can't seem to find any advice/guides for this and I am worrying I made the wrong choice by choosing EF over something simpler/more straight forward!
... issues ... regards to multiple EF applications hitting the same database server?
Rewind a bit to the fact that your application is an ASP .NET MVC based application. Having multiple instances of it is probably going to raise the spectre of state management.
MSDN has a pretty good introduction to why this is an issue:
HTTP is a stateless protocol. This means that a Web server treats each HTTP request for a page as an independent request. The server retains no knowledge of variable values that were used during previous requests. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session. By default, ASP.NET session state is enabled for all ASP.NET applications.
Alternatives to session state include the following:
Application state, which stores variables that can be accessed by all users of an ASP.NET application.
This point is an extremely common way of storing state, but breaks down when there's multiple instances of an application involved (the state is "visible" to only one of the instances).
Typically this is worked around by using either the StateServer or SQLServer value of SessionStateMode. The same article provides a pretty good summary of each option (emphasis mine).
StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
If your application is stateless, this is a moot point.
I am worrying I made the wrong choice by choosing EF
As far as issues with multiple instances of your application accessing a database go, you're going to have issues with any sort of data access technology.
Here's the basic scenario: let's say your application sends welcome emails to users on a schedule.
Given the table Users:
UserId | Email | WelcomeLetterSent
-------+-----------------+------------------
1 | user#domain.com | 0
And some psuedo-code:
foreach (var user in _context.Users.Where(u => !u.WelcomeLetterSent))
{
SendEmailForUser(user);
user.WelcomeLetterSent = true;
}
_context.SaveChanges();
There's a race condition where both instance one and instance two of your application might simultaneously evaluate _context.Users.Where(...) before either of them has the chance to set WelcomeLetterSent = true and call SaveChanges. In this case, two welcome emails might get sent to each user instead of one.
Concurrency can be an insidious thing. There's a primer on managing concurrency with the Entity Framework over here, but this is only the tip of the iceberg.
The answer to your question? It depends on what your application does :)
On top of that, I ideally want to build some "extra" support applications that hook in to the same DB... and, I am just not sure how EF will handle multiple apps to the same DB....
If your application can tolerate multiple instances of itself accessing one database, then it's usually not a stretch to make these "support applications" play nicely. It's not much different whether the concurrency is from multiple instances of one application or multiple applications with one instance each.
In my mvc application adding one web role(same project with another web role) in service definition file, but am getting an error like "No Project Associated with(webrole name)".
My query is,
1) Is there any chance to run the one project with two web roles?
2) Presently my application is working one web role with one instance and VMsize="small".but my application running with low performance.
3)Is there any chance to increase the application performance by increasing the number of instance in the role?
Thanks,
PCSSCP.
The error "No Project Associated with ..." means that you have specified the existence of another web role, but there is no project in your solution (ASP.NET webproject, MVC project) that should be deployed as that webrole. Make soure you have two web projects in your solution, when using two web roles.
As an alternative you can deploy to web projects in a single web role.
Increasing the VM size gives your web role more resources (CPU speed, RAM, ...) to perform, which might increase the performance experience for visitors.
Using more instances won't make the application faster, but since all requests are shared amongst the instances, you can serve more users at the same time.
I'm searching for information on database connectivity (Firebird in my case) with IntraWeb Applications.
I especially need to know the difference(s) involved in using the database on the TDataModule with LockDataModule function, or using the database on the UserSessionUnit.
For example i need to have the database totally disconnected if no users are using the server, and at most 30 users will be connected.
I may at worst have to connect to some old paradox Database and i need a structure that could handle that (i know that i'll have to generate a folder based on WebApplication.AppID to handle sessions). At worst...
Thanks in advance for any piece of information or useful links you could provide me ^^
Scenario 1 - You leave "Pool Data Connections" unchecked in the Intraweb Application Wizard
In this scenario the wizard creates a ServerController, a UserSession but not a DataModule. You place your database, session and dataset components on the UserSession.
Whenever a new user connects to your website a new instance of the UserSession is created and a connection to the database is made. When the ServerController.SessionTimeOut expires due to user inactivity the UserSession is destroyed and that particular connection to the database is severed.
For 30 concurrent users this model will probably be fine for you and should guarantee that all database connections will be severed when the website is not in use.
Scenario 2 - You check "Pool Data Connections" in the Intraweb Application Wizard
As well as the ServerController and the UserSession the wizard will create an empty DataModule. You place your database, session and dataset components on the DataModule.
The ServerModule has a TIWDataModulePool component on it which has PoolCount property.
When your application starts it creates PoolCount instances of the DataModule each one of which makes a connection to the database. As your pages require database access they call LockDataModule and UnlockDataModule to temporarily make use of one of the DataModule instances from the pool.
When your application closes the DataModule instances in the pool are destroyed and their connections to the database are closed.
This model is appropriate when having an open database connection per user would exceed the capabilities of your database server. For just 30 users connecting to a FireBird database I don't believe it would be required.
You may want to consider using a component set like kbmMW by http://www.components4programmers.com/ I have used this for years with Desktop apps ans now with IW apps. I deploy my apps as Services and currently having a few issues deploying as an ISAPI. kbmMW is well suited for an app with lots of connections as it offers connection pooling etc... It has many features and benefits. Check out site for yourself.
I use the Enterprise version, though I think the free version may be useful to you.
Cheers!
-Lou
can somebody list the uses of JMX in web application other than logging. I am new to JMX and logging seems to be the only good use of JMX.
Thanks in advance
You can you JMX to administer and manage components of a web application. For starters, most, if not all, Java EE web application servers register a lot of MBeans to provide monitoring and administration capabilities to several of their resources such as, connection pools, transaction managers, deployed applications, etc. You can then use a JMX client, like JConsole that comes with the JDK/JRE, to attach to a running application server and manage those components.
You can take it one step further, by creating and registering you own, custom MBeans to help manage and control portions of your applications. As an example, if your web app is using a cache of some kind to boost response times, you could create a control object that is capable of flushing the cache, change entry eviction times, disabling the cache, etc. Then you could register the control with the MBean server which in turn would make it accessible through the JMX client.
I have done this many times to provide an administration console into my web applications without the need to create any custom user interface.