This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if i bump number of concurrent subscriptions to 400 my vm freezes :), but otherwise it works fine. so may be some resource bottleneck | |
#is resulting in the errors | |
postgres@pg:~/temp$ cat run.sh | |
#!/bin/bash | |
for i in {1..3} | |
do | |
pg_ctl -D db$i -l db${i}.log stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postgres@pg:~/temp$ initdb -D db1 | |
postgres@pg:~/temp$ pg_ctl -D db1 -l db1.log start | |
waiting for server to start.... done | |
server started | |
postgres@pg:~/temp$ | |
postgres@pg:~/temp$ pg_basebackup -D replica -R -c fast -C -S replica -d "port=5432" | |
postgres@pg:~/temp$ vim replica/postgresql.auto.conf | |
postgres@pg:~/temp$ pg_ctl -D db2 -l db2.log start | |
pg_ctl: directory "db2" does not exist | |
postgres@pg:~/temp$ pg_ctl -D replica -l replica.log start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postgres@pg:~/citusdb$ more setup.sh | |
#!/bin/bash | |
export PATH=/usr/lib/postgresql/14/bin:$PATH | |
port=5432 | |
for i in db1 db2 db3 db4 | |
do | |
pg_ctl -D $i stop | |
rm -rf $i | |
initdb -D $i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/22157718/postgres-group-by-timestamp-into-6-hourly-buckets | |
select count(1), trunc(extract (minute from x) / 5) from generate_series(now() - '60 minute'::interval, now(), '1 minute'::interval) x group by trunc(extract (minute from x) / 5) order by 2 desc; | |
count | trunc | |
-------+------- | |
5 | 11 | |
5 | 10 | |
5 | 9 | |
5 | 8 | |
5 | 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
how to generate a unique request id mapping to app request to a db query request. | |
i have a setup of | |
1) postgresql | |
2) flask app running on port 5000 | |
3) haproxy running on port 8000 with backend as flask app. haproxy also generated a uuid header mapping app request to postgresql query. | |
``` | |
postgres@pg:~$ cat /etc/haproxy/haproxy.cfg | |
global |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is coredns | |
CoreDNS is an open-source Domain Name System (DNS) server software that can be used to provide DNS services for applications and services running in cloud-native environments. It is written in Go and is designed to be highly modular and extensible, allowing users to customize its functionality to suit their specific needs. | |
CoreDNS is often used as a replacement for traditional DNS servers like BIND, which can be difficult to configure and manage in cloud-native environments. CoreDNS supports a wide range of DNS features, including DNS-over-TLS, DNS-over-HTTPS, DNSSEC, and plugin-based customization of DNS functionality. | |
CoreDNS is used in many cloud-native platforms, including Kubernetes, which uses CoreDNS as its default DNS server. It can also be used as a standalone DNS server or as a component in larger cloud-native architectures. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
what is consul from hashicorp | |
Consul is a tool for service discovery, configuration, and orchestration, developed by HashiCorp. It is an open-source solution that helps with managing distributed systems and microservices-based architectures. | |
Consul enables service discovery by maintaining a catalog of available services and their network locations. It also provides health checking capabilities to ensure that services are available and responsive. Additionally, Consul can be used to configure applications and services, as well as to manage and distribute secrets, such as API keys, passwords, and certificates. | |
Consul also includes a key-value store for storing and retrieving configuration data, and it supports distributed locking for coordination between multiple instances of a service. It also provides a built-in DNS server, allowing services to be discovered by name. | |
Consul is highly configurable and can be used in a variety of deployment scenarios, including on-premises, in the cloud, and in hybrid enviro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vijaykumar Jain | |
What is redis | |
Redis (short for Remote Dictionary Server) is an open-source, in-memory data structure store that is commonly used as a database, cache, and message broker. It was created in 2009 by Salvatore Sanfilippo, and is often referred to as a key-value store, as it allows developers to store and retrieve data using keys and values. | |
Redis can store data structures such as strings, hashes, lists, sets, and sorted sets, and provides advanced features such as transactions, pub/sub messaging, Lua scripting, and support for multiple programming languages. Because Redis keeps data in memory, it can perform read and write operations very quickly, making it well-suited for use cases where high-performance and low latency are important, such as real-time applications. | |
Redis is popular in web applications and is used by many large companies like Twitter, GitHub, and Stack Overflow. Its ease of use, performance, and flexibility have made it a popular choice for a wide variety of use cases. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is virtualisation | |
Virtualization is a technology that allows creating an abstraction layer on top of a physical server, network, or storage, allowing multiple virtual entities to run on the same physical hardware. This provides benefits such as increased utilization, reduced costs, improved scalability, and enhanced disaster recovery. There are different types of virtualization, including server virtualization, network virtualization, storage virtualization, and desktop virtualization. | |
Vijaykumar Jain | |
If I create two virtual machines, are they completed Isolated from each other | |
Yes, generally virtual machines are isolated from each other by default. They run on a virtualized environment, with each virtual machine having its own operating system, software, and applications, which are separate from those of other virtual machines. This provides the illusion of having multiple, independent systems running on a single physical machine, with each virtual machine operating as if it were a physical machine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vijaykumar Jain | |
what is the postgresql FEBE protocol | |
FEBE (Fast Execution of Batches in the Eventual Consistency Environment) is a protocol for executing multiple database commands in a single network round trip, as opposed to executing them one-by-one. It is specifically designed for databases like PostgreSQL, which support executing multiple commands in a single network round trip. The FEBE protocol can help reduce network overhead and improve performance in high-concurrency environments, where multiple clients are executing database commands simultaneously. | |
Vijaykumar Jain | |
what is the flow of packets when a simple select is fired from the client to postgresql server | |
When a client sends a simple "SELECT" statement to a PostgreSQL server, the following sequence of events takes place: |