Local development with Google App Engine go111 using dev_appserver is slow - go

I am locally running a GAE go111 program using dev_appserver.py on a reasonably fast Windows10 desktop. I have to use dev_appserver as I'm running in classic compatibility mode by calling
appengine.Main()
I have an end point that I install using
http.HandleFunc("/TC/", handleTestConnection)
This endpoint has no code in it
func handleTestConnection(w http.ResponseWriter, r *http.Request) {
}
Each time I try to access this endpoint using...
http://127.0.0.1:8080/TC/
...it takes ~2 seconds to respond. This happens on all endpoints regardless of warmup or complexity. This is not a first run problem, it will happen each time I call the endpoint.
The logs from dev_appserver are as follows...
DEBUG 2021-09-24 19:14:10,460 module.py:1499] Dispatching request to <Instance 9cca95d2ec7bedafddd44639c7e2cd139bfc: 0/8, total: 1> after 0.0000s pending
DEBUG 2021-09-24 19:14:12,490 <string>:134] API server executing remote_api_pb.Request:
service_name: "logservice"
method: "Flush"
request: "\n\000"
request_id: "uumGeJVDum"
DEBUG 2021-09-24 19:14:12,492 <string>:194] API server responding with remote_api_pb.Response:
DEBUG 2021-09-24 19:14:12,492 <string>:493] Handled logservice.Flush in 0.0020
DEBUG 2021-09-24 19:14:12,493 instance.py:410] Request handled by <Instance 9cca95d2ec7bedafddd44639c7e2cd139bfc: 1/8, total: 2> in 2.0320s
INFO 2021-09-24 19:14:12,493 module.py:883] default: "GET /TC/ HTTP/1.1" 200 -
INFO 2021-09-24 19:14:12,516 module.py:883] default: "GET /favicon.ico HTTP/1.1" 200 1150
Everything works correctly and fast once deployed to a Google app engine server, it's just local development that is slow.
I have tried numerous options of dev_appserver including...
--logs_path
--dev_appserver_log_level
--log_level
--threadsafe_override
--max_module_instances
--datastore_consistency_policy
--enable_host_checking
I have tried running natively using
go run .
But as this is in classic compatibility mode this does not work.
I have tried turning off virus checkers / firewalls. Other browsers. Using localhost. Other ports. 3 completely different desktops. Using host=0.0.0.0 then my local ip. All result in the same delay.
Has anyone hit and solved this problem?

Related

pdm-installed streamlit fails to launch a server

I have installed streamlit on my Mac with pdm and launched the command streamlit hello to view the demos. The command returns the following:
❯ pdm run streamlit hello
2022-03-21 11:43:45.812 WARNING streamlit.config:
Warning: the config option 'server.enableCORS=false' is not compatible with 'server.enableXsrfProtection=true'.
As a result, 'server.enableCORS' is being overridden to 'true'.
More information:
In order to protect against CSRF attacks, we send a cookie with each request.
To do so, we must specify allowable origins, which places a restriction on
cross-origin resource sharing.
If cross origin resource sharing is required, please disable server.enableXsrfProtection.
2022-03-21 11:43:45.816 DEBUG streamlit.logger: Initialized tornado logs
2022-03-21 11:43:45.818 DEBUG matplotlib.pyplot: Loaded backend agg version unknown.
2022-03-21 11:43:45.819 DEBUG streamlit.bootstrap: Setting up signal handler
2022-03-21 11:43:45.819 DEBUG asyncio: Using selector: KqueueSelector
2022-03-21 11:43:45.827 DEBUG streamlit.server.server: Starting server...
2022-03-21 11:43:45.827 DEBUG streamlit.server.server: Serving static content from the Node dev server
2022-03-21 11:43:45.830 DEBUG streamlit.server.server: Server started on port 8501
2022-03-21 11:43:45.831 DEBUG streamlit.server.server: Server state: State.INITIAL -> State.WAITING_FOR_FIRST_BROWSER
2022-03-21 11:43:46.029 DEBUG git.cmd: Popen(['git', 'version'], cwd=<my/working/directory>, universal_newlines=False, shell=None, istream=None)
2022-03-21 11:43:46.041 DEBUG git.cmd: Popen(['git', 'version'], cwd=<my/working/directory>, universal_newlines=False, shell=None, istream=None)
2022-03-21 11:43:46.054 DEBUG git.cmd: Popen(['git', 'version'], cwd=<my/working/directory>, universal_newlines=False, shell=None, istream=None)
2022-03-21 11:43:46.066 DEBUG git.cmd: Popen(['git', 'rev-parse', '--show-toplevel'], cwd=<my/working/directory>, universal_newlines=False, shell=None, istream=None)
Welcome to Streamlit. Check out our demo in your browser.
Local URL: http://localhost:3000
Network URL: http://192.168.1.117:3000
Ready to create your own Python apps super quickly?
Head over to https://docs.streamlit.io
May you create awesome apps!
However, when I connect to the local URL, the connection is rejected:
I tried switching to Brave Browser and Firefox, but I got the same error.
From other SO questions, I tried the following:
❯ apachectl configtest
AH00557: httpd: apr_sockaddr_info_get() failed for Lucas-MacBook-Air.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
I also ran this:
ps -ax | grep 'httpd'
124 ?? 0:00.85 /usr/sbin/httpd -D FOREGROUND
517 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
6627 ttys002 0:00.01 grep httpd
I tried launching other stuff that creates a local server, e.g. Jupyter Notebooks, and they work.
The problem is known: streamlit does not support pdm at the time of writing, as mentioned by #cye18 on the parallel issue opened on pdm's github page.
The problem is that, while streamlit configs default to server port 8501, the server is launched on the port 3000. You can force this behaviour in two ways.
The first is by manually changing streamlit's settings, which lies in ~/.streamlit/config.toml or locally in your project directory.
[server]
serverPort = 8501
Alternatively, you can add the following flag to the streamlit command when launching it:
pdm run streamlit run app.py --server.port 8501
Either way, streamlit will complain by saying that server.port does not work when global.developmentMode is true. Once again, this can be solved by adding the flag --global.developmentMode false. The final command will look like this: pdm run streamlit run app.py --server.port 8501 --global.developmentMode false.
Alternatively, the local settings will look like the following:
[server]
port = 8501
[global]
developmentMode = false

Taskqueue tasks not executing in dev server

I have enqueued tasks to local taskqueue server using the google task queue library google.golang.org/appengine/taskqueue. But the execution is failing with the following error:
INFO 2021-05-24 09:28:13,310 module.py:865] default: "POST /endpoint HTTP/1.1" 409 104
WARNING 2021-05-24 09:28:13,310 taskqueue_stub.py:2149] Task task36 failed to execute. This task will retry in 204.800 seconds
Is there some config in dev server that i need to configure for this to work? The same is working on production environment, but only dev server has this problem
I'm using Go version 1.11.13

Fineract doesn't start in mac Mojave

I followed exact same step as per [1] and when I execute
./gradlew tomcatRunWar
Process didn't work after 92%
16:14:48.912 [localhost-startStop-1] INFO o.s.j.c.CachingConnectionFactory - Established shared JMS Connection: ActiveMQConnection {id=ID:Gayans-MacBook-Pro.local-58639-1559299488784-1:1,clientId=null,started=false}
16:14:48.971 [localhost-startStop-1] INFO o.a.f.i.c.b.WarWebApplicationInitializer - Started WarWebApplicationInitializer in 58.585 seconds (JVM running for 141.561)
The following warnings have been detected with resource and/or provider classes:
WARNING: A HTTP GET method, public java.lang.String org.apache.fineract.portfolio.self.savings.api.SelfSavingsApiResource.template(java.lang.Long,java.lang.Long,java.lang.String,javax.ws.rs.core.UriInfo), should not consume any entity.
Started Tomcat Server
The Server is running at http://localhost:8080/fineract-provider
Building 92% > :tomcatRunWar
[1] https://github.com/apache/fineract
./gradlew tomcatRunWar is actually a way to run the Fineract App in Dev mode. The logs you pasted shows Fineract is actually doing the right thing by starting up in Dev mode. What you can do now is get the web app here: https://github.com/openMF/community-app, build it using the instructions in the read me and try to login to the Fineract backend using username: mifos, password: password

loopback gets errors when slc run after installing socket.io

After I install socket.io, when I run the loopback API, it gives the following errors. I have tried to uninstall the socket.io or re-install the loopback but it still happens. BTW, I can access the API without any problems but it keeps to show so many errors in the console. So, How should I solve this errors?
INFO strong-agent v2.0.2 profiling app 'Xamarin_Node_API' pid '4076'
INFO strong-agent[4076] started profiling agent
INFO supervisor reporting metrics to `internal:`
supervisor running without clustering (unsupervised)
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
Error: Cannot GET /socket.io/?EIO=3&transport=polling&t=635806057373451120-193&b
64=1
at raiseUrlNotFoundError (G:\Users\MM\Xamarin_Node_API\node_modules\loopback
\server\middleware\url-not-found.js:15:17)
at Layer.handle [as handle_request] (G:\Users\MM\Xamarin_Node_API\node_modul
es\loopback\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (G:\Users\MM\Xamarin_Node_API\node_modules\loopback\node_modu
les\express\lib\router\index.js:312:13)
at G:\Users\MM\Xamarin_Node_API\node_modules\loopback\node_modules\express\l
ib\router\index.js:280:7
at Function.process_params (G:\Users\MM\Xamarin_Node_API\node_modules\loopba
ck\node_modules\express\lib\router\index.js:330:12)
at next (G:\Users\MM\Xamarin_Node_API\node_modules\loopback\node_modules\exp
ress\lib\router\index.js:271:10)
at G:\Users\MM\Xamarin_Node_API\node_modules\loopback\node_modules\express\l
ib\router\index.js:618:15
at next (G:\Users\MM\Xamarin_Node_API\node_modules\loopback\node_modules\exp
ress\lib\router\index.js:256:14)
at Function.handle (G:\Users\MM\Xamarin_Node_API\node_modules\loopback\node_
modules\express\lib\router\index.js:176:3)
at router (G:\Users\MM\Xamarin_Node_API\node_modules\loopback\node_modules\e
xpress\lib\router\index.js:46:12)

Puma server dies with no reason

I'm running Puma 2.8.2 server for stubbing some of my back end services. Occasionally Puma server just dies without any reason.
There is no errors in error.log And here is excerpt from access.log:
10.210.140.21 - - [15/Oct/2014 09:28:22] "GET /status HTTP/1.1" 200 - 0.0030
- Gracefully stopping, waiting for requests to finish
- Goodbye!
=== puma startup: 2014-10-15 09:28:24 +0100 ===
10.210.140.21 - - [15/Oct/2014 09:28:24] "GET /status HTTP/1.1" 200 - 0.0254
Any thoughts what could cause this?
If this problem is becoming in Heroku and you are using Heroku free dyno, the problem is that you use the free dyno. Because your app goes to sleep after 30 minutes of inactivity.
You can find more info at the following link:
https://devcenter.heroku.com/articles/free-dyno-hours

Resources