Skip to content

Instantly share code, notes, and snippets.

import locust
import gevent
from clients import HTTPClient
from gevent import wsgi
# Defines the behaviour of a locust (aka a website user :)
def website_user(name):
c = HTTPClient('http://localhost:8088')
for i in range(0, 10):
c.get('/fast', name='Fast page') # Request the fast page
import time
time.sleep(123)
# A simple script to test memory allocation/deallocation in Python
#
# When run under Win32 with Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02)
# [MSC v.1500 32 bit (Intel)]
# it will after each allocation release all memory back the OS.
#
# However, when run under Linux/RHEL5 with
# Python 2.6 (r26:66714, Jun 15 2009, 17:33:43)
# [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]
# it never releases the memory again, thus eating more and more memory.
import java.net.InetSocketAddress;
import java.net.URI;
import java.util.concurrent.Executors;
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
import org.jboss.netty.handler.codec.http.HttpHeaders;
import org.jboss.netty.handler.codec.http.HttpMethod;
import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import java.util.HashMap;
import java.util.Map;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
import org.jboss.netty.channel.*;
import static org.jboss.netty.channel.Channels.pipeline;
import org.jboss.netty.handler.codec.http.*;
import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
import org.jboss.netty.channel.*;
import static org.jboss.netty.channel.Channels.pipeline;
import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
import org.jboss.netty.handler.execution.ExecutionHandler;