How to handle database connection pooling in django with postgresql - django

I have a django application every api hit in django creating one db connection to handle that request and basically this is an overhead as this is creating several connections if there are multiple requests to handle so I want to have db connection pooling or persistent connection for efficient handling.
I have gone through the django doc for this as there is CONN_MAX_AGE parameter but that doesn't solve the problem as that won't be using older connection to handle new request so what should be the best way to manage open db connections.

Related

Is it possible to use django as a proxy for websoxket

I have a service (written in erlang) that accepts websocket connection from my django application. Django serves the page and the js script that makes the calls to the erlang service.
Now I want to go through the django server also for websocket connection and messaging. That is to use django as a proxy that forwards websocket connection and messages from the client to the Erlang service and sends back responses from the erlang service to the client. Optionally django should also check request authorization before forwarding them.
Is that possible?

Handle request over TCP connection using django

I'm developing a server using django. There are numbers of devices that connect to this server and send request periodically. How can I handle these requests properly?
You'll probably want to look into django signals to setup webhooks to listen for certain things to call other things etc... signals was built to keep your app in sync with changes being made throughout. https://docs.djangoproject.com/en/dev/topics/signals/

Difference between a web-service and web-socket

As I mentioned in the title: I would like to know the difference between the web-service and the web-socket? when we used each one?
Thanks!
A web service is an HTTP server that responds to client SOAP/REST/JSON requests.
A web socket is a client-side API that allows a web browser to create a bidirectional communication link with a server without having to change/reload the current page. This is typically used for AJAX requests to dynamically update live content on the current page, or create chat sessions between clients, or implement custom protocols that run in the web browser.
Web services are based on HTTP protocol and use HTTP methods to relay data in a request and response paradigm. Thus the client will always be the one responsible for communicating with the server, requesting data and submitting data to the server i.e getting list of customers or products, adding products or customers to server.
In contrast, Web sockets allow bidirectional communication, meaning server can initiate communication as much as client can do the same. Typically you supply a host IP Address and port to the socket. Web sockets can be used to implement a chat application.
The key difference between Web sockets and Web services is that with web sockets you get bi-directional connection in which the server and client can continuously send messages back and forth while Web services are uni-directional connection concerned with supplying clients with resources

Passing Server URL using Variable in Webserver connection manager

I m a newbie, learning SSIS. Currently I am trying to get data from webservice and import it to database table. When establishing the connection to the server. Is it possible to send it using variable instead of hardcoding it in HTTP connection manager Editior?
Right-click on the connection manager and select "Parametrize". The rest of it should be self-explanatory.

Using Connection Based State with Apache2

I am writing an HTTPS based application using Apache2 as the web server, and python as the language (not sure which framework or Apache2 mod yet). After clients (which are not web browsers) first establish an HTTPS connection to the server, they are expected to send an authentication message. If authentication is successful, they are able to send more commands, until the connection is closed (HTTP 1.1 will be used, with a long keep alive time). My question is, is it possible to have state associated with the connection? I don't want the client to have to send cookies or session ids -- the HTTPS application should be able to figure out the session based on the connection that each request belongs to...the question is how?
HTTP/S is a State less protocol, so you if you don't want to have cookies maintaing the state then you must pass on the state to server each time using hidden variables or query params or some other means and take care of it in server side.
One possible solution is using SSL_SESSION_ID, which is accessible to applications using mod_python, to uniquely identify each client. The problem with this is the ID can apparently change -- but it isn't clear to me whether it can change in the middle of a connection (which would be problematic), or only between connections (which is good -- I actually would need to enforce this behavior).
Anyway, this is the sort of thing I'm looking for, if it wasn't clear from the original question.