Skip to content

Commit 29c7544

Browse files
committed
Add cidr blacklist
1 parent c794b12 commit 29c7544

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

src/com/jacamars/dsp/rtb/bidder/CampaignSelector.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public BidResponse getMaxConnections(BidRequest br) throws Exception {
115115
List<Campaign> list = Preshuffle.getInstance().getPreShuffledCampaignList();
116116

117117
if (list == null) {
118-
logger.error("No preshuffled campaigns lists");
118+
logger.debug("No preshuffled campaigns lists");
119119
return null;
120120
}
121121

@@ -196,6 +196,9 @@ public BidResponse getMaxConnections(BidRequest br) throws Exception {
196196
if (RTBServer.frequencyGoverner != null)
197197
RTBServer.frequencyGoverner.add(winner.camp.adId,br);
198198

199+
if (xtest) {
200+
logger.info("Selected winner in " + xtime + " ms");
201+
}
199202
return winner;
200203
}
201204

src/com/jacamars/dsp/rtb/bidder/RTBServer.java

+11-7
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public class RTBServer implements Runnable {
152152
/**
153153
* number of threads in the jetty thread pool
154154
*/
155-
public static int threads = 1024;
155+
public static int threads = 2048;
156156

157157
/**
158158
* a counter for the number of requests the bidder has received and
@@ -199,6 +199,7 @@ public class RTBServer implements Runnable {
199199
* The average time
200200
*/
201201
public volatile static long avgBidTime;
202+
public volatile static String savgbidtime = "0";
202203
public volatile static long avgNoBidTime;
203204

204205
public volatile static long throttleTime = 0;
@@ -536,7 +537,7 @@ public void run() {
536537
return;
537538
}
538539

539-
QueuedThreadPool threadPool = new QueuedThreadPool(threads, 50);
540+
QueuedThreadPool threadPool = new QueuedThreadPool(threads, 128);
540541
server = new Server(threadPool);
541542
ServerConnector connector = null;
542543

@@ -649,7 +650,7 @@ public void run() {
649650
void startSeparateAdminServer() throws Exception {
650651
SSL ssl = Configuration.getInstance().ssl;
651652

652-
QueuedThreadPool threadPool = new QueuedThreadPool(threads, 50);
653+
QueuedThreadPool threadPool = new QueuedThreadPool(threads, 128);
653654
Server server = new Server(threadPool);
654655
ServerConnector connector;
655656

@@ -752,7 +753,7 @@ private void startPeridocLogger() throws Exception {
752753
davgNoBidTime /= nowindow;
753754

754755
String sqps = String.format("%.2f", qps);
755-
String savgbidtime = String.format("%.2f", davgBidTime);
756+
savgbidtime = String.format("%.2f", davgBidTime);
756757
String savgnobidtime = String.format("%.2f", davgNoBidTime);
757758

758759
long a = ForensiqClient.forensiqXtime.get();
@@ -1285,9 +1286,12 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
12851286
String rs= request.getQueryString();
12861287
String rtype = request.getParameter("target");
12871288
if (rtype == null) {
1288-
logger.warn("Warning, wrong callback message, params: {}",rs);
1289-
response.getWriter().println("");
1290-
return;
1289+
rtype = request.getParameter("type");
1290+
if (rtype == null) {
1291+
logger.warn("Warning, wrong callback message, params: {}",rs);
1292+
response.getWriter().println("");
1293+
return;
1294+
}
12911295
}
12921296
boolean debug = false;
12931297
String dbg = request.getParameter("debug");

src/com/jacamars/dsp/rtb/bidder/WebCampaign.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ private List getStatus() throws Exception {
874874
values.put("errors", RTBServer.error);
875875
values.put("adspend", RTBServer.adspend);
876876
values.put("qps", RTBServer.qps);
877-
values.put("avgx", RTBServer.avgx);
877+
values.put("avgx", RTBServer.savgbidtime);
878878
values.put("exchanges", BidRequest.getExchangeCounts());
879879
values.put("cperf", CampaignProcessor.probe.getMap());
880880
} else {

src/com/jacamars/dsp/rtb/common/Configuration.java

+4-13
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,11 @@ public void initialize(String path, String shard, int port, int sslPort, String
396396
* USE ZOOKEEPER, AEROSPIKE OR FILE CONFIG
397397
*********************************************/
398398
String str = null;
399-
if (path.startsWith("zookeeper")) {
400-
String parts[] = path.split(":");
401-
logger.info("Zookeeper: {}", "" + parts);
402-
zk = new ZkConnect(parts[1]);
403-
zk.join(parts[2], "bidders", instanceName);
404-
str = zk.readConfig(parts[2] + "/bidders");
405-
} else {
406-
byte[] encoded = Files.readAllBytes(Paths.get(path));
407-
str = Charset.defaultCharset().decode(ByteBuffer.wrap(encoded)).toString();
408-
409-
str = Configuration.substitute(str);
399+
byte[] encoded = Files.readAllBytes(Paths.get(path));
400+
str = Charset.defaultCharset().decode(ByteBuffer.wrap(encoded)).toString();
410401

411-
System.out.println(str);
412-
}
402+
str = Configuration.substitute(str);
403+
System.out.println("AFTER SUBSTITUTIONS, CONFIGURATION:\n" + str);
413404

414405
Map<?, ?> m = DbTools.mapper.readValue(str, Map.class);
415406
/*******************************************************************************/

web/admin.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ <h3 class="panel-title">Templates</h3>
12231223
total_qps += qps;
12241224
sqps = Number(qps).toFixed(2);
12251225
}
1226-
systemDyno.add([e.name, v.total,v.request,v.fraud,v.bid,v.nobid,v.win,v.pixels,v.clicks,v.errors,pbid,pwin,ppix,pclc,percFraud,spnd,sqps,Number(v.avgx).toFixed(6)]);
1226+
systemDyno.add([e.name, v.total,v.request,v.fraud,v.bid,v.nobid,v.win,v.pixels,v.clicks,v.errors,pbid,pwin,ppix,pclc,percFraud,spnd,sqps,v.avgx]);
12271227
total += v.total;
12281228
bid += v.bid;
12291229
nobid += v.nobid;
@@ -2054,7 +2054,7 @@ <h3 class="panel-title">Templates</h3>
20542054
listsDyno = new DynamicTable("addlists",listCells);
20552055

20562056
systemCells = [];
2057-
systemCells.push("<input type='text' id='SUB_ID' size='30' readonly value=''/>");
2057+
systemCells.push("<input type='text' id='SUB_ID' size='20' readonly value=''/>");
20582058
systemCells.push("<input type='text' id='SUB_ID' size='8' readonly value='' style='text-align:right;'/>");
20592059
systemCells.push("<input type='text' id='SUB_ID' size='8' readonly value='' style='text-align:right;'/>");
20602060
systemCells.push("<input type='text' id='SUB_ID' size='8' readonly value='' style='text-align:right;'/>");

0 commit comments

Comments
 (0)