Is there a way to decrease request download time for requirejs with Apache Tomcat 9.0.48 +? - requirejs

I have an application loading modules via requirejs running on an Apache Tomcat server (9.0.48). When upgrading from tomcat 9.0.46 to 9.0.48, I've noticed inconsistent page loading with error Load timeout for modules: ....
When the module loading fails, Content Download time for the larger modules (jquery, wysihtml5) goes from ~100ms to 1 minute. Overall, the entire page load time increased from ~500ms to ~600ms. I haven’t observed download times larger than 200ms with tomcat-coyote from tomcat 9.0.46; seems like this is new with the 9.0.48 tomcat-coyote lib.
Is there a way to speed up the module download times?
Configuration
requirejs config
requirejs loaded as data-main:
<script type="text/javascript" src="/configurator/assets/js/lib/utils/require-2.3.6.min.js" data-main="/configurator/assets/js/main"></script>
requirejs.config({
"paths" : {
"jquery" : "lib/jquery/jquery-1.8.3",
"jquery-ui" : "lib/jquery/jquery-ui-1.10.3.custom.min",
"fileupload" : "lib/jquery/jquery.fileupload",
"jquery.iframe" : "lib/jquery/jquery.iframe-transport",
"jquery.ui.widget" : "lib/jquery/jquery.ui.widget",
"jquery.ba-hashchange" : "lib/jquery/jquery.ba-hashchange",
"underscore" : "lib/utils/lodash-1.0.0-rc3.min",
"wysihtml5" : "lib/xing-wysihtml5/wysihtml5-0.3.0",
"wysihtml5_parserrules" : "lib/xing-wysihtml5/advanced",
"bootstrap" : "lib/bootstrap/bootstrap-2.1.0.min",
"can" : "lib/can/can",
"configurator" : "app/configurator",
},
"shim" : {
"jquery": {
"deps" : [ ],
"exports" : "jQuery"
}
"underscore" : {
"deps" : [ ],
"exports" : "_"
},
"less" : {
"deps" : [ ],
"exports" : "less"
},
"fileupload" : {
"deps" : [ "jquery" ],
"exports" : "fileupload"
},
"bootstrap" : {
"deps" : [ "jquery-ui" ],
"exports" : "bootstrap"
},
"jquery-ui" : {
"deps" : [ "jquery" ],
"exports" : "jquery-ui"
},
"jquery.iframe" : {
"deps" : [ "jquery" ],
"exports" : "jquery.iframe"
},
"jquery.ui.widget" : {
"deps" : [ "jquery" ],
"exports" : "jquery.ui.widget"
}
},
"modules" : [ {
"name" : "main"
} ],
"appDir" : ".",
"baseUrl" : "../../../configurator/assets/js",
"waitSeconds": "0"
});
require([
'jquery',
'can',
'underscore',
'configurator',
'bootstrap'
], function($, can, _, Configurator) {
...
});
});
Tomcat Connector config
<Connector port="8443" address="0.0.0.0" SSLEnabled="true"
maxHttpHeaderSize="8192" emptySessionPath="false"
maxKeepAliveRequests="-1"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLSv1.2" sslEnabledProtocols="TLSv1.2"
keystoreFile="..." keystorePass="..." keystoreType="..."
useBodyEncodingForURI="true" URIEncoding="UTF-8"
ciphers="..." />

This issue appears to be fixed in Tomcat 9.0.52. Associated Bug: https://bz.apache.org/bugzilla/show_bug.cgi?id=65448

Related

convert 3d geometry to gltf

** Ask through a translator.
I want to express 3d geometry in gltf. (want to use in cesium js)
Fist, convert the coordinates to ECEF coordinates.
Next, I created a gltf file.
However, it does not look neat on the preview screen. (ms code extension)
And trembling occurs when moving.
I want to know the cause.
** coordinates (epsg 4326)
-73.561001356474, 45.4966833629139, 19.9
-73.5610780383518, 45.4967314096038, 19.9
-73.5610843141094, 45.4967252603133, 19.9
-73.561001356474, 45.4966833629139, 19.9
** preview gltf (ms code extension)
enter image description here
** gltf source
{
"scenes" : [
{
"nodes" : [ 0 ]
}
],
"nodes" : [
{
"mesh" : 0
}
],
"meshes" : [
{
"name": "gltf test",
"primitives" : [
{
"attributes" : {
"POSITION" : 1
},
"indices" : 0,
"mode": 4
}
]
}
],
"buffers" : [
{
"uri" : "data:application/octet-stream;base64,AAABAAIAAAAYtZpJTBWDyiIhikritJpJSBWDyiohikrftJpJSRWDyikhiko=",
"byteLength" : 44
}
],
"bufferViews" : [
{
"buffer" : 0,
"byteOffset" : 0,
"byteLength" : 6,
"target" : 34963
},
{
"buffer" : 0,
"byteOffset" : 8,
"byteLength" : 36,
"byteStride": 12,
"target" : 34962
}
],
"accessors" : [
{
"bufferView" : 0,
"byteOffset" : 0,
"componentType" : 5123,
"count" : 3,
"type" : "SCALAR"
},
{
"bufferView" : 1,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 3,
"type" : "VEC3",
"min" : [ 1267355.8953368044, -4295333.93970134, 4526225.02467026],
"max" : [ 1267363.054331189, -4295331.983019848, 4526228.767742585]
}
],
"asset" : {
"version" : "2.0"
}
}
You haven't shared how you created this file, so we can't really tell you the cause of the issue. I would recommend adding enough information to fully reproduce the problem. But importantly, the file you've shared has only three vertices. Try inspecting it in VS Code's glTF addon.

Write test output to file in NightwatchJS

I want to write the actual test output of NightwatchJS tests (not the browser console) to a file. I can't seem to find any resource regarding about this.
The log_path option is ok, it does log some stuff on the location you specified after the test, but its not the same data vs the actual test output.
below is my nightwatch.json file
{
"src_folders" : [
"tests" ,
"tests/settings/general"
],
"page_objects_path" : [
"page_objects/backend" ,
"page_objects/frontend" ,
"page_objects/backend/settings/general"
],
"globals_path" : "./nightwatch.globals.js",
"webdriver" : {
"start_process" : true,
"log_path" : "./logs"
},
"test_settings" : {
"default" : {
"webdriver": {
"server_path" : "node_modules/.bin/chromedriver",
"port" : 9515,
"cli_args" : [ "--log" , "debug" ]
},
"desiredCapabilities": {
"browserName" : "chrome",
"acceptInsecureCerts" : true,
"javascriptEnabled" : true,
"acceptSslCerts" : true
}
},
"firefox" : {
"webdriver": {
"server_path" : "node_modules/.bin/geckodriver",
"port" : 4444,
"cli_args" : [ "--log" , "debug" ]
},
"desiredCapabilities": {
"browserName" : "firefox",
"acceptInsecureCerts" : true,
"javascriptEnabled" : true,
"acceptSslCerts" : true
}
}
}
}
Hope you can help me on this.
Thanks in advance.
You could add '> tests_output/Test_filename.txt' after the command to run the test. So, I have my package.json file set up with the script 'test' for running Nightwatch. My terminal input to save the output as a file would look like this:
npm test > /tests_output/testRun100720.txt
This will place the output file I name testRun100720.txt into the tests_output folder.
Can you provide a little more detail of what you mean by 'output'?
In the meantime, try adding "output_folder": "reports/", to your json file, this should generate XML output from the Nightwatch logger which may provide more details.

AWS Autoscale Load Balancing with Cloudformation

I'm trying to create an EC2 instance, that will use autoscaling, attached to a load balancer.
Unfortunately, I'm getting the error
The availability zones of the specified subnets and the AutoScalingGroup do not match
However, this is my current Cloudformation script:
"ApiAutoScaling" : {
"Type" : "AWS::AutoScaling::AutoScalingGroup",
"Properties" : {
"VPCZoneIdentifier" : [ "subnet-5ff05206", "subnet-b1109fc6", "subnet-948ce5f1" ],
"InstanceId" : {
"Ref" : "ApiEC2"
},
"MaxSize" : 3,
"MinSize" : 1,
"LoadBalancerNames" : [ "Api" ]
}
},
"ApiLoadBalancer" : {
"Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties" : {
"LoadBalancerName" : "Api",
"Listeners" : [
{
"InstancePort" : "80",
"InstanceProtocol" : "HTTP",
"LoadBalancerPort" : "80",
"Protocol" : "HTTP"
},
{
"InstancePort" : "80",
"InstanceProtocol" : "HTTP",
"LoadBalancerPort" : "443",
"Protocol" : "HTTPS",
"SSLCertificateId" : "arn:aws:iam::xxx"
}
],
"SecurityGroups" : [ "sg-a88444cc" ],
"Subnets" : [ "subnet-5ff05206", "subnet-b1109fc6", "subnet-948ce5f1" ]
}
}
As you can see, my subnet list is the same for both my autoscaling group and my load balancer. Clearly I've misunderstood how this is supposed to work, but I can't work it out.
Try specifying the AvailabilityZones property for the auto scaling group. The default is for it to use all of them, so if your subnets only use a subnet of the zones, you would get this error message.
(As pointed out in the comments, "AvailabilityZones" : { "Fn::GetAZs" : "" } should do the trick.)

Jquery Conflict when use requirejs with jquery from google apis

I have problem conflict when import more jquery files in on my project. The context in here is : i'm running a project without import requirejs, on this project i have already imported jquery and some jquery plugins on that, it works fine. And now, i need to use a service from the other site, it need to use requirejs to loading some javascript files from that site :
prefixUrl = "http://mysite.com";
require = {
baseUrl : prefixUrl + "/js",
waitSeconds : 30,
paths : {
"jquery" : "http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min",
"jquery.validate" : "/jquery.validate.min-1.8.1",
"jquery.string" : "/jQueryString-2.0.2-Min",
"jquery.cookie" : "/jquery.cookie",
"jquery.lightbox" : "/lightbox/jquery.lightbox",
"thickbox" : "/thickbox/thickbox",
"marketo.form" : "mktFormSupport",
"templates" : "../templates",
"login" : "/cloud-workspaces-extension/js/login",
"rememberme-checkbox" : "/platform-extension/javascript/iphone-style-checkboxes"
},
shim : {
'jquery.validate' : [ "jquery" ],
'jquery.string' : [ "jquery" ],
'jquery.cookie' : [ "jquery" ],
'jquery.lightbox' : [ "jquery" ],
"thickbox" : [ "jquery" ],
"marketo.form" : {
deps : [ "jquery" ],
exports : "Mkto"
},
"rememberme-checkbox" : [ "jquery" ]
},
deps : [ "jquery", "jquery.validate", "jquery.string", "jquery.cookie" ].
callback: function(){
// handle
}
}
As you can see, it will be loading more a jquery file 1.7 from googleapis. That means it will overrite the current jquery on my project (i didn't use jquery noConflict) and some jquery plugins which init when the page load and document ready has been reset and remove instances their handles.
So, anybody can help me find another the solution for this case? I can use jquery noconflict for the current on my site, but that mean i will replace a lots of things javascript running good on my site. So, i'm looking for the good way can be import the service and workaround in it.

Chrome Extension Port error: Could not establish connection. Receiving end does not exist

I've tried browsing through similar questions posted here, but none seems to work
Manifest.json
{
"manifest_version": 2,
"name" : "A simple Found Text Demo",
"description" : "Bla",
"version" : "1.0",
"background" : {
"pages" : "background.html"
},
"page_action" : {
"default_icon" : "icon.png"
},
"content_scripts" : [{
"matches" : ["*://*/*"],
"js" : ["contentscript.js"]
}]
}
Background.html
<html>
<script>
chrome.extension.onMessage.addListener(
function(request, sender, sendResponse){
alert(request);
//chrome.pageAction.show(sender.tab.id);
sendResponse('Found!');
}
)
</script>
</html>
Contentscript.js
chrome.extension.sendMessage({"name" : "hola"}, function(res){
console.log(res); })
However I repeatedly get the same error :
Port error: Could not establish connection. Receiving end does not exist.
Any ideas?
Since things changed over to manifest 2, you are actually no longer allowed to use in-line scripts (such as what you have in your background.html in the <script> tags above. See here). I'm not sure of your use case, but in most cases simple cases (read: the stuff I've done :) ), you don't actually need to populate background.html with anything. Instead, you can directly pass in a background.js file that will contain the same script you have above. Therefore you can try changing your manifest.json to this:
{
"manifest_version": 2,
"name" : "A simple Found Text Demo",
"description" : "Bla",
"version" : "1.0",
"background" : {
"scripts" : ["background.js"]
},
"page_action" : {
"default_icon" : "icon.png"
},
"content_scripts" : [{
"matches" : ["*://*/*"],
"js" : ["contentscript.js"],
"run_at": "document_end"
}]
}
Note we did two things here - changed pages to scripts inside of background and pointed it to ["background.js"], and then added "run_at": "document_end" to the end of the content_scripts section. This is something that can definitely cause issues if left out (issues similar to what you are seeing now) - you are now telling the content script to run after the page has loaded. If it runs immediately, you run the risk of the background page not having loaded, which means it isn't yet ready to receive messages and gives you the connection error. Below is background.js, which is identical to the script you had in between your <script> tags before:
chrome.extension.onMessage.addListener(
function(request, sender, sendResponse){
alert(request);
//chrome.pageAction.show(sender.tab.id);
sendResponse('Found!');
}
)

Resources