Skip to content

Commit c7a4424

Browse files
optimize performance & improve stability
1 parent e6d6c0d commit c7a4424

21 files changed

Lines changed: 413 additions & 506 deletions

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ Next, specify the necessary set of keys in the project
7070
-Dcom.sun.management.jmxremote.local.only=false
7171
-Dcom.sun.management.jmxremote.authenticate=false
7272
-Dcom.sun.management.jmxremote.ssl=false
73+
-Xms256g
74+
-Xmn512m
75+
-Xmx4g
76+
-XX:MaxMetaspaceSize=256m
77+
-XX:ParallelGCThreads=8
78+
-XX:ConcGCThreads=4
7379
```
7480

7581
To run a single local interference node, you can use the standard
@@ -100,5 +106,11 @@ java -cp interference.jar
100106
-Dcom.sun.management.jmxremote.local.only=false
101107
-Dcom.sun.management.jmxremote.authenticate=false
102108
-Dcom.sun.management.jmxremote.ssl=false
109+
-Xms256g
110+
-Xmn512m
111+
-Xmx4g
112+
-XX:MaxMetaspaceSize=256m
113+
-XX:ParallelGCThreads=8
114+
-XX:ConcGCThreads=4
103115
su.interference.standalone.Start
104116
```

doc/InterferenceManual.pdf

4.44 KB
Binary file not shown.

interference-2020.1.jar

-1.24 KB
Binary file not shown.

interference-2020.1.jar.md5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dda5a3ba8ed161e2bbab852457b37b5d *interference-2020.1.jar
1+
9d28e75b094559c9bb7ceb1fcc145b7f *interference-2020.1.jar

src/main/java/su/interference/core/Chunk.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ this software and associated documentation files (the "Software"), to deal in
2828
import su.interference.persistent.Session;
2929
import su.interference.persistent.UndoChunk;
3030

31+
import java.lang.reflect.Field;
3132
import java.lang.reflect.InvocationTargetException;
3233
import java.net.MalformedURLException;
3334

@@ -41,9 +42,8 @@ public interface Chunk extends Comparable {
4142
Header getHeader();
4243
void setHeader(Header header);
4344
byte[] getChunk();
44-
void setChunk(byte[] chunk);
4545
int getBytesAmount();
46-
Comparable getId (Session s) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException;
46+
Comparable getId (Field idfield, Session s) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException;
4747
ValueSet getDcs();
4848
boolean isTerminate();
4949
void setTerminate(boolean terminate);

src/main/java/su/interference/core/ChunkIdComparator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ChunkIdComparator(Session s) {
4141

4242
public int compare(Chunk c1, Chunk c2) {
4343
try {
44-
return c1.getId(s).compareTo(c2.getId(s));
44+
return c1.getId(null, s).compareTo(c2.getId(null, s));
4545
} catch (Exception e) {
4646
throw new RuntimeException(e);
4747
}

src/main/java/su/interference/core/ChunkMap.java

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,72 +37,80 @@ public class ChunkMap {
3737
private final ConcurrentHashMap<Integer, Chunk> hmap;
3838
private final ConcurrentHashMap<ValueSet, Chunk> imap;
3939
private final List<Chunk> list;
40+
private final Frame frame;
4041
private volatile boolean sorted;
4142

42-
public ChunkMap() {
43+
public ChunkMap(Frame frame) {
4344
hmap = new ConcurrentHashMap<>();
4445
imap = new ConcurrentHashMap<>();
4546
list = new CopyOnWriteArrayList<>();
47+
this.frame = frame;
4648
}
4749

48-
public void sort() {
50+
public synchronized void sort() {
4951
Collections.sort(list);
5052
sorted = true;
5153
}
5254

53-
public void add(Chunk c) {
55+
public synchronized void add(Chunk c) {
5456
hmap.put(c.getHeader().getPtr(), c);
55-
imap.put(c.getDcs(), c);
57+
if (frame instanceof IndexFrame) {
58+
imap.put(c.getDcs(), c);
59+
}
5660
list.add(c);
5761
sorted = false;
5862
}
5963

60-
public List<Chunk> getChunks() {
64+
public synchronized List<Chunk> getChunks() {
6165
return list;
6266
}
6367

64-
public Chunk getByPtr(int i) {
68+
public synchronized Chunk getByPtr(int i) {
6569
return hmap.get(i);
6670
}
6771

68-
public Chunk get(int i) {
72+
public synchronized Chunk get(int i) {
6973
return list.get(i);
7074
}
7175

72-
public Chunk getByKey(ValueSet key) {
76+
public synchronized Chunk getByKey(ValueSet key) {
7377
return imap.get(key);
7478
}
7579

76-
public void removeByPtr(int i) {
80+
public synchronized void removeByPtr(int i) {
7781
final boolean x = list.remove(hmap.get(i));
7882
final Chunk c = (Chunk)hmap.remove(i);
79-
imap.remove(c.getDcs());
83+
if (frame instanceof IndexFrame) {
84+
imap.remove(c.getDcs());
85+
}
8086
sorted = false;
8187
if (!x || c == null) {
8288
throw new RuntimeException("Internal error during remove object from frame");
8389
}
8490
}
8591

86-
public void remove(int i) {
92+
public synchronized void remove(int i) {
8793
final Chunk c = list.get(i);
8894
list.remove(i);
8995
hmap.remove(c.getHeader().getPtr());
90-
imap.remove(c.getDcs());
96+
if (frame instanceof IndexFrame) {
97+
imap.remove(c.getDcs());
98+
}
9199
sorted = false;
92100
}
93101

94-
public int size() {
102+
public synchronized int size() {
95103
return list.size();
96104
}
97105

98-
public void clear() {
106+
public synchronized void clear() {
99107
hmap.clear();
100108
list.clear();
101109
imap.clear();
102110
sorted = false;
103111
}
104112

105-
public boolean isSorted() {
113+
public synchronized boolean isSorted() {
106114
return sorted;
107115
}
108116
}

0 commit comments

Comments
 (0)