Skip to content

Instantly share code, notes, and snippets.

View Karm's full-sized avatar
🎪
Staring at my screen

Karm Michal Babacek Karm

🎪
Staring at my screen
View GitHub Profile
@Karm
Karm / ProxyPass config
Last active December 17, 2015 01:49
mod_cluster 1.2.3 versus mod_cluster 1.2.4 ProxyPass run
ProxyPassMatch ^/app/static/ !
ProxyPass /app balancer://qacluster stickysession=JSESSIONID|jsessionid nofailover=on
ProxyPass / !
ProxyPassReverse /app balancer://qacluster
ProxyPassReverseCookieDomain / /app/
ProxyPassReverseCookiePath / /app/
ProxyPreserveHost on
@Karm
Karm / testsock.c
Created May 24, 2013 09:21
httpd-2.2.23/srclib/apr/test/testsock.c:314: rv = apr_sockaddr_info_get(&sa, "::ffff:0.0.0.0", APR_INET6, 80, 0, p);
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Karm
Karm / test_remove_zones.c
Last active December 17, 2015 17:28
A test for a possible solution (or shall we call it a workaround? :-D) to https://issues.jboss.org/browse/MODCLUSTER-339
/**
* author Michal Karm Babacek <mbabacek@redhat.com>
* Test zone remover
*/
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#define LEN(x) (sizeof(x) / sizeof(x[0]))
import java.lang.management.ManagementFactory
import java.lang.management.OperatingSystemMXBean
/**
* @author Michal Karm Babacek
*/
OperatingSystemMXBean bean = ManagementFactory.getOperatingSystemMXBean()
println "load: ${bean?.getSystemLoadAverage()}"
println "avail. processors: ${bean?.getAvailableProcessors()}"
/**
* @author Michal Karm Babacek
*/
NetworkInterface.getNetworkInterfaces().each {iface ->
println "Iface Display name: ${iface.getDisplayName()}"
println "Iface Name: ${iface.getName()}"
iface.getSubInterfaces().each {subiface ->
println "\tSubiface Display name: ${subiface.getDisplayName()}"
println "\tSubiface Name: ${subiface.getName()}"
}
@Karm
Karm / mod_cluster.conf
Last active January 4, 2016 02:40
mod_cluster minimal example, mod_cluster 1.3.x, httpd 2.4.x
LoadModule proxy_module /opt/jboss/httpd/lib/httpd/modules/mod_proxy.so
LoadModule proxy_ajp_module /opt/jboss/httpd/lib/httpd/modules/mod_proxy_ajp.so
LoadModule cluster_slotmem_module /opt/jboss/httpd/lib/httpd/modules/mod_cluster_slotmem.so
LoadModule manager_module /opt/jboss/httpd/lib/httpd/modules/mod_manager.so
LoadModule proxy_cluster_module /opt/jboss/httpd/lib/httpd/modules/mod_proxy_cluster.so
LoadModule advertise_module /opt/jboss/httpd/lib/httpd/modules/mod_advertise.so
<IfModule manager_module>
Listen 127.0.0.1:6666
ManagerBalancerName mycluster
ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (transport-thread--p14-t16) ISPN000136: Error executing command PrepareCommand, writing keys [jboss-eap-7.0-3]: org.infinispan.util.concurrent.TimeoutException: Timed out waiting for topology 6
at org.infinispan.statetransfer.StateTransferLockImpl.waitForTransactionData(StateTransferLockImpl.java:92)
at org.infinispan.interceptors.base.BaseStateTransferInterceptor.waitForTransactionData(BaseStateTransferInterceptor.java:96)
at org.infinispan.statetransfer.StateTransferInterceptor.handleTxCommand(StateTransferInterceptor.java:258)
at org.infinispan.statetransfer.StateTransferInterceptor.visitPrepareCommand(StateTransferInterceptor.java:87)
at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:173)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:99)
at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextIntercep
@Karm
Karm / undertow.batch
Created November 6, 2015 11:15
Undertow mod_cluster proxy ruidementary config
/socket-binding-group=standard-sockets/socket-binding=modcluster-adv:add(multicast-address=224.0.5.12, port=35409, multicast-port=35409)
/subsystem=undertow/configuration=filter:read-resource(include-runtime=true, recursive=true, recursive-depth=100)
/subsystem=undertow/configuration=filter/mod-cluster=modcluster:add(management-socket-binding=http,advertise-socket-binding=modcluster-adv)
/subsystem=undertow/server=default-server/host=default-host/filter-ref=modcluster:add()
/subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=DEBUG)
/subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=DEBUG)
reload
@Karm
Karm / sinkit.c
Created April 25, 2016 17:14
Snippet
KR_EXPORT
int consume(knot_layer_t* ctx, knot_pkt_t* pkt) {
struct kr_request *req = ctx->data;
struct kr_query *qry = req->current_query;
if (!qry || ctx->state & (KNOT_STATE_FAIL)) {
return ctx->state;
}
char hostname[KNOT_DNAME_MAXLEN];
switch(qry->stype) {
static int proxy_cluster_trans(request_rec *r)
{
const char *balancer;
void *sconf = r->server->module_config;
proxy_server_conf *conf = (proxy_server_conf *)
ap_get_module_config(sconf, &proxy_module);
proxy_vhost_table vhost_table;
proxy_context_table context_table;
proxy_balancer_table balancer_table;