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 / gist:5389258
Created April 15, 2013 16:15
Define Thread Pools for HTTP Connector in AS7
1) ./subsystem=threads/thread-factory=http-connector-factory:add(group-name="my-cool-pool",thread-name-pattern="HTTP-%t", priority="9")
2) ./subsystem=threads/unbounded-queue-thread-pool=my-cool-pool:add(thread-factory="http-connector-factory", keepalive-time={time=30, unit="seconds"}, max-threads=30)
3) ./subsystem=web/connector=http:write-attribute(name=executor, value="my-cool-pool")
Translates into:
...
<subsystem xmlns="urn:jboss:domain:threads:1.1">
@Karm
Karm / gist:5395463
Last active December 16, 2015 06:59
AS7: How to add mod_cluster to standalone.xml profile? Composite operation workaround to https://issues.jboss.org/browse/JBPAPP6-1420:

Add extension

/extension=org.jboss.as.modcluster:add()

Add ajp connector

/subsystem=web/connector=ajp:add(name=ajp,protocol=ajp,scheme=ajp,socket-binding=ajp)

Composite operation for mod_cluster without advertising, with proxy-list (list of balancers)

/**
* Find the best nodes for a request (check host and context (and balancer))
* @param r the request_rec
* @param balancer the balancer (balancer to use in that case we check it).
* @param route from the sessionid if we have one.
* @param use_alias compare alias with server_name
* @return a pointer to a list of nodes.
*/
static node_context *find_node_context_host(request_rec *r, proxy_balancer *balancer, const char *route, int use_alias, proxy_vhost_table* vhost_table, proxy_context_table* context_table)
{
@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]))
@Karm
Karm / mod_cluster.conf
Created June 7, 2013 11:23
mod_cluster SSL configuration for httpd balancer and AS7 worker
# mod_proxy_balancer should be disabled when mod_cluster is used
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule advertise_module modules/mod_advertise.so
MemManagerFile /home/karm/test/cache/mod_cluster
ServerName hellbox:8888
<IfModule manager_module>
Listen hellbox:8888
@Karm
Karm / mod_cluster.conf
Created June 24, 2013 14:21
mod_cluster and ProxyPass, /static from httpd instance
# mod_proxy_balancer should be disabled when mod_cluster is used
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule advertise_module modules/mod_advertise.so
# Set to some _local_ place (absolute path), definitely not an NFS...
MemManagerFile /home/mbabacek/EAP6/cache/mod_cluster
ServerName 127.0.0.1:8888
@Karm
Karm / Apache HTTP error_log
Last active August 29, 2015 13:56
mod_cluster / mod_proxy integration, BalancerMember setup, a lot of Friday fun....
[Fri Feb 14 08:58:42 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:unconfined_r:unconfined_java_t:s0-s0:c0.c1023
[Fri Feb 14 08:58:42 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Feb 14 08:58:42 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Feb 14 08:58:42 2014] [notice] Digest: done
[Fri Feb 14 08:58:42 2014] [debug] util_ldap.c(1990): LDAP merging Shared Cache conf: shm=0x7ffb94307980 rmm=0x7ffb943079d8 for VHOST: 10.16.88.19
[Fri Feb 14 08:58:42 2014] [debug] util_ldap.c(1990): LDAP merging Shared Cache conf: shm=0x7ffb94307980 rmm=0x7ffb943079d8 for VHOST: 10.16.88.19
[Fri Feb 14 08:58:42 2014] [info] APR LDAP: Built with OpenLDAP LDAP SDK
[Fri Feb 14 08:58:42 2014] [info] LDAP: SSL support available
[Fri Feb 14 08:58:42 2014] [notice] Advertise initialized for process 15553
[Fri Feb 14 08:58:42 2014] [debug] proxy_util.c(1818): proxy: grabbed scoreboard slot 4 in child 15555 for worker proxy:reverse
@Karm
Karm / STOP-APP_log
Last active August 29, 2015 13:57
STOP-APP Playing around...
curl "http://BOX666:8847/clusterbench/jvmroute" -i
HTTP/1.1 200 OK
Date: Fri, 14 Mar 2014 15:15:09 GMT
Set-Cookie: JSESSIONID=G6iMXP1R9g69aF0c6+0kHzBy.jboss-eap-6.3; Path=/clusterbench
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 13
Connection: close
jboss-eap-6.3