This file contains hidden or 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
| package funsets | |
| import org.scalatest.FunSuite | |
| import org.junit.runner.RunWith | |
| import org.scalatest.junit.JUnitRunner | |
| /** | |
| * This class is a test suite for the methods in object FunSets. To run | |
| * the test suite, you can either: |
This file contains hidden or 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
| const char *activevcl = NULL ; | |
| char *vclentry = NULL ; | |
| char *result = NULL; | |
| if (!strcmp(request->url, "/vclactive") || !strcmp(request->url,"/vclactive/")) { | |
| ipc_run(vcl->vadmin,&vret,"vcl.list"); | |
| if (vret.status == 400) { | |
| send_response_fail(request->connection, vret.answer); | |
| } else { |
This file contains hidden or 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
| controller | |
| --------------- | |
| package com.example.app | |
| import org.scalatra._ | |
| import org.json4s.{DefaultFormats, Formats} | |
| import org.scalatra.json._ | |
| import com.example.app.models.User | |
| import com.example.app.serializers.UserSerializer |
This file contains hidden or 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
| controller | |
| ------------- | |
| package com.example.app | |
| class MyController extends ScalatraServlet with JacksonJsonSupport { | |
| implicit val jsonFormats = DefaultFormats + new UserSerializer | |
| before() { | |
| contentType = formats("json") |
This file contains hidden or 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
| val cpdsMaster = { | |
| val props = new Properties | |
| props.load(getClass.getResourceAsStream("/c3p0-master.properties")) | |
| val cpds = new ComboPooledDataSource | |
| cpds.setProperties(props) | |
| logger.info("Created Master c3p0 connection pool") | |
| cpds | |
| } | |
| val cpdsSlave = { |
This file contains hidden or 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
| [root@vm-64-12-251-107 wrk-master]# ./wrk -c 500 -t 2 -d 10 http://149.174.163.27:8080/scalatra/ | |
| Running 10s test @ http://149.174.163.27:8080/scalatra/ | |
| 2 threads and 500 connections | |
| Thread Stats Avg Stdev Max +/- Stdev | |
| Latency 208.13ms 152.62ms 914.08ms 86.99% | |
| Req/Sec 821.14 479.63 2.00k 73.98% | |
| 18991 requests in 10.00s, 4.44MB read | |
| Socket errors: connect 0, read 0, write 0, timeout 486 | |
| Requests/sec: 1898.61 | |
| Transfer/sec: 454.26KB |
This file contains hidden or 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
| import org.eclipse.jetty.server.Server | |
| import org.eclipse.jetty.servlet.{ServletHolder, ServletContextHandler} | |
| import javax.servlet.http.{HttpServletResponse, HttpServletRequest, HttpServlet} | |
| /** | |
| * @author ross | |
| */ | |
| object ServletExample extends App { | |
| import concurrent.ExecutionContext.Implicits.global |
This file contains hidden or 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
| -module(test). | |
| -export([start/0,load_data/1,run_select/0,run_foldl/0]). | |
| -define(TAB,testets). | |
| start() -> | |
| load_ets_table(), | |
| load_data(100000), | |
| io:format("Load data complete~n"), | |
| {T,_} = timer:tc(?MODULE,run_select, []), |
This file contains hidden or 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
| SockjsState = sockjs_handler:init_state(<<"/socket">>,fun wsocket_handler/3, state, []), | |
| VRoutes = [{[<<"socket">>, '...'], sockjs_cowboy_handler, SockjsState}, | |
| {'_', ?MODULE, []}], | |
| Routes = [{'_', VRoutes}], | |
| lager:info("Starting the cowboy listener on port ~p..~n",[?COWBOY_HTTP_PORT]), | |
| cowboy:start_http(my_http_listener, ?COWBOY_HTTP_ACCEPTORS, [{port, ?COWBOY_HTTP_PORT}], [{dispatch, Routes}]). | |
| Protoopts is [{dispatch, | |
| [{'_', | |
| [{[<<"socket">>,'...'], |
This file contains hidden or 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
| 22:29:19.609 [error] gen_server <0.1120.0> terminated with reason: bad argument in call to ets:select_delete(websocket, [{{{'_','_',{sockjs_session,{<0.1120.0>,[{peername,{{127,0,0,1},58181}},{sockname,{{127,0,0,...},...}},...]}}},...},...}]) in ets:match_delete/2 line 313 | |
| 22:29:19.614 [error] CRASH REPORT Process <0.1120.0> with 1 neighbours exited with reason: bad argument in call to ets:select_delete(websocket, [{{{'_','_',{sockjs_session,{<0.1120.0>,[{peername,{{127,0,0,1},58181}},{sockname,{{127,0,0,...},...}},...]}}},...},...}]) in ets:match_delete/2 line 313 in gen_server:terminate/6 line 715 | |
| 22:29:19.616 [error] Supervisor sockjs_session_sup had child undefined started with sockjs_session:start_link(undefined, {service,"/socket",#Fun<outbreak_sockjs_handler.0.133591038>,state,"http://cdn.sockjs.org/sockjs...",...}, [{peername,{{127,0,0,1},58181}},{sockname,{{127,0,0,1},8080}},{path,"/socket/websocket"},{headers,...}]) at <0.1120.0> exit with reason bad argument in call to ets:select_delete(websocket, |
NewerOlder