I am having some problem in writing jade script.So am wondering if i could host my webpages
on apache. Once the page opens it will open a socket to port 3000 and then node server will start pushing notifications.
Will it give some warning in browser? any other concern with this approach?
So Apache willl run on 80
node on 3000
I had done this once for testing purposes, works well, no warnings were given.
Concerns would be that splitting website background on two servers will bring an extra complexity to the project. If you will load any parts from node initially, it will cause longer loading time, because you will only be able to establish connection to node when main page from apache will finish load. Also there is a possibility of duplicated code doing same thing under different servers.
In conclusion I would say that if there is no special needs from other servers, I would try my best to keep everything on node with jade, even if that would require some learning, it will definitely payback later.
If the only reason you're using apache is to serve the initial page, I would suggest the nginx in that case, because it is more lightweight but I haven't tested it by myself.
Related
I tend to get this annoying error alot using Netbeans 7.2. The that occassionally comes up is,
Starting of Tomcat failed, the server port 8084 is already in use.
I'm part of a small group of developers and a couple of us have encountered this, and our solution is to go simply kill the Java process using it.
However, our boss insists that this isn't necessary and that my "Duct-tape solutions" are NOT adequate.
It's not a task given to me or anything, but it is annoying and I'm wondering if he's right. Is there a permanent solution to this Apache Tomcat error? Is there some way for me to configure Apache Tomcat so that this won't happen again?
Update
That would also work, but I don't see how that's any better than me going in and killing the stupid process. Your solution would only mean I have more than one instance of the same app server running. But, what I wanted was a way to prevent the stupid Apache Tomcat instance from still staying up even though I wanted to kill it using the IDE.
Use a different port for the Tomcat. You can easily change the port number in net-beans by simply moving on to servers>tomcat and right click .. properties. and change the port to say 8083 etc...
I may be giving entirely the wrong information here, but at the moment we're a bit unsure where to look for the issue. We have a server running on WebLogic, of which version I'm not sure.
Our site has an installer that clients need that can run around 15 MB. Normally, this downloads perfectly fine, but we've recently been finding issues in the download where the browser reports it completed, but the installer can't be opened - it appears that the filesize isn't what it's expected to be either, like the download was just cut off.
The issues are relegated to instances where the user is on a spotty connection, such as a 3G card in their laptop.
It seems to happen mostly on Macs, but it seems like that's because the mac .dmg file is much larger than the windows executable. Still, from my knowledge of network protocols, a spotty network shouldn't cause the specific issue we're seeing.
At the moment, we're debugging several of the layers of the transfer, like our firewalls, but with my meager knowledge of Weblogic, I'm kind of curious if there is something we could be missing in the server's configuration itself.
Unfortunately, I'm not sure if I am able to post the configuration files here - I'm pretty sure at the moment, there are no servlet rules created specifically for the installer's directory - but I was hoping someone here might at least recognize this type of issue and be able to point me in the right direction.
Check if you have any maxpostsize limit set.
Check for the responses that has failed if there's any socket timeout errors seen in the log file.
If you are using a proxy, check for error there related mainly to sockets.
Such issues can come when a tcp socket is timed out at the firewall end, WLS end, Frontend proxy like apache end.
There are few other settings like http connection timeout I think in WLS.
check from admin console-server-protocol-general tab or http tab.
I was wondering if it would be okay to run Tomcat as both the web server and container? On the other hand, it seems that the right way to go about scaling your webapp is to use Apache HTTP listening on port 80 and connecting that to Tomcat listening on another port?
Are both ways acceptable? What is being used nowdays? Whats the prime difference? How do most major websites go about this?
Thanks.
Placing an Apache (or any other webserver) in front of your application server(s) (Tomcat) is a good thing for a number of reasons.
First consideration is about static resources and caching.
Tomcat will probably serve also a lot of static content, or even on dynamic content it will send some caching directives to browsers. However, each browser that hits your tomcat for the first time will cause tomcat to send the static file. Since processing a request is a bit more expensive in Tomcat than it is in Apache (because of Apache being super-optimized and exploiting very low level stuff not always available in Tomcat, because Tomcat extracting much more informations from the request than Apache needs etc...), it may be better for the static files to be server by Apache.
Since however configuring Apache to serve part of the content and Tomcat for the rest or the URL space is a daunting task, it is usually easier to have Tomcat serve everything with the right cache headers, and Apache in front of it capturing the content, serving it to the requiring browser, and caching it so that other browser hitting the same file will get served directly from Apache without even disturbing Tomcat.
Other than static files, also many dynamic stuff may not need to be updated every millisecond. For example, a json loaded by the homepage that tells the user how much stuff is in your database, is an expensive query performed thousands of times that can safely be performed each hour or so without making your users angry. So, tomcat may serve the json with proper one hour caching directive, Apache will cache the json fragment and serve it to any browser requiring it for one hour. There are obviously a ton of other ways to implement it (a caching filter, a JPA cache that caches the query etc...), but sending proper cache headers and using Apache as a reverse proxy is quite easy, REST compliant and scales well.
Another consideration is load balancing. Apache comes with a nice load balancing module, that can help you scale your application on a number of Tomcat instances, supposed that your application can scale horizontally or run on a cluster.
A third consideration is about ulrs, headers etc.. From time to time you may need to change some urls, or remove or override some headers. For example, before a major update you may want to disable caching on browsers for some hours to avoid browsers keep using stale data (same as lowering the DNS TTL before switching servers), or move the old application on another url space, or rewrite old URLs to new ones when possible. While reconfiguring the servlets inside your web.xml files is possible, and filters can do wonders, if you are using a framework that interprets the URLs you may need to do a lot of work on your sitemap files or similar stuff.
Having Apache or another web server in front of Tomcat may help a lot changing only Apache configuration files with modules like mod_rewrite.
So, I always recommend having Apache httpd in front of Tomcat. The small overhead on connection handling is usually recovered thanks to caching of resources, and the additional configuration works is regained the first time you need to move URLs or handle some headers.
It depends on your network and how you wish to have security set up.
If you have a two-firewall DMZ, with applications deployed inside the second firewall, it makes sense to have an Apache or IIS instance in between the two firewalls to handle security and proxy calls into the app server. If it's acceptable to put the Tomcat instance in the DMZ you're free to do so. The only downside that I see is that you'll have to open a port in the second firewall to access a database inside. That might put the database at risk.
Another consideration is traffic. You don't say anything about traffic, sizing servers, and possible load balancing and clustering. A load balancer in front of a cluster of app servers is more likely to be kept inside the second firewall. The Tomcat instance is capable of handling traffic on its own, but there are always volume limitations depending on the hardware it's deployed on and what the application is doing with each request. It's almost impossible to give a yes or no answer without more detailed, application-specific information.
Search the site for "tomcat without apache" - it's been asked before. I voted to close before finding duplicates.
I have two application written in lift with embedded jetty. The first one is maintaining session based on SessionVar implementation. And that is working great without any problem.
In second application I am using Basic Authentication, which is also working great.
The problem arises when I open both applications in the same browser in different tabs. Even though both applications are running on different ports, the second application causes first to session out.
Does any one have got any idea what's the problem is and how do I resolve this issue?
I am using scala 2.9.0.1 and lift 2.4-M1.
The HTTP port does not affect session management at all. The web server will see them as the same thing. If you want to run them both concurrently, perhaps try accessing one at 127.0.0.1 and the other at localhost, thus negating the issue of them being on the same perceived host.
FWIW, LiftSession is not instantiated at the time of basic authentication; i'm pretty sure its cached by the browser and not by Lift.
Which one of these two is most commonly used scenario? I want to use the same scenario in my learning process. thanks.
Don't know about the rest of the industry, but where I work we have Apache HTTPD front-ending for Tomcat.
Any static content is directly provided by HTTPD for performance. Pain in the neck to separate every app out, but there is a noticeable payoff.
Also, HTTPD has some nice code for cookie handling, URL rewriting, clustering and so on.
Only if we determine that there's dynamic, database-bound data to show do we forward to Tomcat, which does an admirable job there.
Has been working well for us for almost a decade. Others too, I would wager.