I have a few weeks before the next project & i'm looking/wanting to streamline our development process to give the UX & Devs guys the shortest lead time to change validation (e.g. 10 seconds for a Java change/1 second for UX/JS changes).
Basically, I want what John Lindquist shows in this video (RT feedback with webstorm & the Angular todo list example in 3 minutes) but I with Tomcat & Spring.
Ive been researching/playing this for the last few days with our stack (Tomcat8,Intellij13, Spring4, Angular) and I am just not 'getting it' so think it is my lack of knowledge in this area and i'm missing something (hence the SO question).
What I have achieved to date for UX Guys
Grunt (using node) to serve up the 'static resources'(JS/SCSS/Templates) and livereload to refresh chrome - this is very good and very close to what i want (RT feeback from SCSS/JS/HTML changes) but the big problem is that node is serving the static resources and not TC so with Cross Origin Policies (solved via this and this )- rebuilds in intellij become messy with grunt involved - looked at SCSS compiles with file watchers but it is not gelling) - in short i did not get grunt servicing static & TC the REST API working in harmony. Another option was this guy updates the TC resources with grunt when the file changes but just don't want to go there.
This leads me back to file watchers, jetbrains live edit (what the web storm video shows) and intellij and again, i'm close when it comes to static content as intellij can update the resources on TC on frame deactivation but (and a big BUT) this is NOT real time and when you change resource structure, you need to refresh the page however we are working on a SPA which loses context on refresh which slows the guys down as have to reply sequences to get back to where the change happened and also when using intellij they have to 'frame de-activate' to get the changes pushed to TC (they are on dual monitors so to tab off intellij is the same as pushing a button to deploy the changes )
The best to date is grunt and accept the same origin issues for development but am I missing something for the UX guys?
What I have achieved to date for Dev Guys
Before we start, can't afford jrebel and haven't got Spring Loaded working with intellij and tomcat (yet).
at this stage simply having TC refreshed by intellij with classes change and restart when bean definitions/method structure changes. Bad I know but 'it is what we are use to'
Looking at spring boot - promising but ideally would like not to give the configuration freedom away but it does give live updates on the server I believe.
Grails is out at the moment so can't benefit there.
I know Play allows some real time updates but again, haven't looked at this in detail and a big shift from the current stack.
Summary
On the development side will likely stick to Live Edit and accept the refresh/deactivation issue so we can't 'achieve' what John Lindquist shows in Webstorm, i.e. real time updates when resources changes when using Tomcat/Intellij/Chrome - or at least 'I don't know' how to achieve this?
Server side - i'm still working on this, going to continue to look at spring loaded and intellij integration then look at jrebel and see what budget, if any, we can get but in the meantime is there any alternatives as I see the node/ruby/grails guys getting it all so i believe it must be me and i'm missing the best setup to get super fast feedback from our code changes when using Tomcat & Spring?
In Short, yes it is possible & have achieved what I set out to achieve - that was all developmental changes in a Java EE platform (including JS/SCSS Changes and Spring/Java Changes) to happen in 'real time' (5/10 seconds server, 2 seconds ux). I have recorded a little video showing it all in action (please excuse the lack of dramatics)..
Stack:
AngularJS
Grunt -serving up static pages with an http proxy to /service context calls. The proxy is needed for 2 reasons - 1 is to
get around the Cross origin issues & 2 - so that real time static
resources changes (HTML/JS/SCSS) are shown in Chrome - you can't do this with
tomcat as the resources are copied to the web-app folder in TC and
not being served directly from source (Intellij can redeploy on frame deactivation but that doesn't work well and it doesn't allow for instant changes to be reflected in Chrome)..
Grunt monitors SCSS changes (I believe you could use file watchers in
intellij though but have grunt serving the static content)
Live Edit updates Chrome on the fly.
JRebel for Spring/Server side changes to Tomcat (licence required for
commercial use)
The subtle but important thing is what Grunt is doing..
I think this is a simpler alternative to Ian's solution:
Structure the application in three parts:
REST services (src/main/java) and
Web source files (src/web, don't include them in the final war)
Static files produced by grunt (src/web/dist, and include them in final war at /)
Configure CORS filter (which you need anyway for REST services) [1]
Now the kicker:
Start tomcat (as usual)
Start your angularjs website from src/web (using IntelliJ it's just Debug index.html)
Done -- all your edits in source html/js files are reflected in next browser refresh (or use grunt plugin to make it even more "live")
[1] https://github.com/swagger-api/swagger-core/wiki/CORS
Related
I am using intellij idea to run the project
java version 17
spring boot project build is succeeded.
but when I am start to run the project in Debug mode it takes since 2 hours.
I have tried to add application.properties file by added the below line
logging.level.org.springframework.boot.autoconfigure=DEBUG
Why do you think it shouldn't be like this?
It's a SpringBoot application that is basically a web server with HTTP endpoints. Those endpoints listen for user requests using a number of threads. E.g. StackOverflow runs their own web server (many of them) to serve many many user requests like yours and mine. For that to work, those web server processes must always be active (up and running). The same is with your application.
You can dive a bit deeper and see what your application threads are actually up to. To do that you should click "Get Thread Dump" button. Looking at your screenshot I believe you should click the double arrow icon in the bottom left corner and then you will see the photo camera logo. This is the one you should click to take the thread dump. Mine looks like this:
You can see at least 2 threads are responsible for handling HTTP requests. You will have a similar picture.
Also, it has nothing to do with Debug mode. You can do the same in the Run mode. The logging.level.org.springframework.boot.autoconfigure=DEBUG option is just for logging, as the name implies. This is why you can see some Spring AutoConfiguration info in the IDE console. For example, if I run my similar SpringBoot app without that option set to DEBUG I will only see the following in the console (spot the default INFO logging level):
Hi. I'm having a pretty nasty issue with the app I'm responsible for. The app was running on osgi/karaf + spring + apache camel 2.14.1. I removed osgi/karaf, upgraded spring, and moved all that to the spring boot. Camel version was upgraded to 2.24.1. And we started to see some occasional perf. issues on prod. I wasn't able to see the logs until yesterday, but what I saw there confused me a lot. The app at some point stopped processing the files for one of the routes, while the second route was working fine...
And it lasted for almost 2 hours. Yes, we have pretty high load on it but it was always like that. I just can't figure out what exactly could possibly cause that.
Few small details though... The files which this failing route is monitoring are put to the folder through the symb link. So if the monitoring folder name is /test, there is a link to it in $HOME/test(for a different user) and the other process connects through the sftp and puts files to that folder(it's not a problem with that process, I'm 100% sure that the files were on the server but this thing just didn't see them).
I to be honest have no idea where to dig. The server is pretty old, and the FS is pretty defragmented, we have also disk usage on 100%(but our admins don't think it's related + it was like that before and there were no issues). Java changed by the way from 1.6 to 1.8. I also checked the memory, it doesn't seem like there is an issue, one global GC during the 12 hours, minor collections are not that frequent. I would really appreciate any thoughts... Thank you very much!
Im trying to work out which lazy loading techniques and server setup allow my to server a page quickest, currently im using this workflow :
Test ping and download speed
open quicktime screen recorder (so i can review the network tab and load times if there are any anomalies in the data to see what caused them)
open a new incognito tab with cache disabled and network tab open
load website
save screencast
log ping, download speed, time, date, commit version from git, website loading time into spreadsheet
After i have another test i can the spreadsheet and make a quantified decision on what works.
Running this workflow currently takes about 4 minutes each time i run it (im doing all of these manually, generally i run the same test a couple of times to get an average and then change the variables, image loading js script tweaks and also try it on different VPSs, try it with / without CDN to allow sharding etc.)
Is there an automated approach to doing to ? I guess i could setup a selenium script and run the tests, but i was wandering if there was an of the shelf solution ?
Ideally i would be able to say test it with the following git commits (although i would have to do the server config changes manually) but it would even be quicker i could automate the running, screencasts and logging of the tests.
What is difference between publish and restart in jboss/tomcat? I am really confused about when one should use restart or publish?
Every time I make any change config in my Java(Spring) application(on localhost) I had to do a compile and then perform a restart of server so that it picks up the changes.
Is there any easier way to get the changes picked up?
You could use JRebel if you want to avoid redeploys. It fully supports Spring and you'll see changes immediately reflected in the deployed application. It's a commercial plugin but it saves you a lot of time.
Using the WebSphere Integrated Solutions Console, a large (18,400 file) web application is updated by specifying a war file name and going through the update screens and finally saving the configuration. The Solutions Console web UI spins a while, then it returns, at which point the user is able to start the web application.
If the application is started after the "successful update", it fails because the files that are the web application have not been exploded out to the deployment directory yet.
Experimentation indicates that it takes on the order of 12 minutes for the files to appear!
One more bit of background that may be significant: There are 19 application servers on this one WebSphere instance. WebSphere insists that there be a lot of chatter between them, even though they don't need anything from each other. I wondered if this might be slowing things down when it comes to deployment. Or if there's some timer in the bowels of WebSphere that is just set wrong (usual disclaimers apply...I'm just showing up and finding this situation...I didn't configure this installation).
Additional Information:
This is a Network Deployment configuration, and it's all on one physical host.
* ND 6.1.0.23
Is this a standalone or a ND set up? I am guessing it is ND set up considering you have stated that they are 19 app servers. The nodes should be synchronized with the deployment manager so that the updated files are available to the respective nodes.
After you update and save the changes, try and synchronize the nodes with the dmgr (or alternatively as part of the update process, click on review and the check the box which says synchronize nodes) and this would distribute the changes to the various nodes.
The default interval, i believe is 1 minute.
12 minutes certainly sounds a lot. Is there any possibility of network being an issue here?
HTH
Manglu