Ir para conteúdo

[Duvida] isso pesa o servidor?


SnowRunescape

Posts Recomendados

Bom estou com umas duvidas.. vamos la


 


o arquivo server.log do spigot/craftbukkit pesa o servidor? se eu deixar la acumular 200mb, vai dar alguma queda de desempenho?


 


se eu fazer um plugin, e esse plugin gerar uma log.txt, isso tambem pode lagar o servidor? o plugin so vai escrever nesse arquivo, não vai ler nada!


Link para o comentário
Compartilhar em outros sites

Time=1001 current=17039499 total=17039499
Time=1001 current=20410464 total=37449963
Time=1001 current=20154180 total=57604143
Time=1001 current=22312357 total=79916500
Time=1001 current=21992000 total=101908500
Time=1001 current=21510460 total=123418960
Time=1001 current=22155314 total=145574274
Time=1001 current=22194777 total=167769051
Time=1001 current=22090400 total=189859451
Time=1001 current=21786771 total=211646222
Time=1001 current=21067038 total=232713260
Time=1001 current=19926183 total=252639443
Time=1001 current=22345447 total=274984890
Time=1001 current=20426906 total=295411796
Time=1001 current=19978704 total=315390500
Time=1001 current=20383500 total=335774000
Time=1001 current=19780496 total=355554496
Time=1001 current=20180077 total=375734573
Time=1001 current=20222427 total=395957000
Time=1001 current=22576791 total=418533791
Time=1001 current=21117571 total=439651362
Time=1001 current=19855160 total=459506522
Time=1001 current=19777284 total=479283806
Time=1001 current=20213508 total=499497314
Time=1001 current=20044574 total=519541888
Time=1001 current=20536112 total=540078000
Time=1001 current=20309330 total=560387330
Time=1001 current=20321924 total=580709254
Time=1001 current=20213712 total=600922966
Time=1001 current=22047034 total=622970000
Time=1001 current=20966970 total=643936970
Time=1001 current=21753551 total=665690521
Time=1001 current=21901321 total=687591842
Time=1001 current=21931913 total=709523755
Time=1001 current=21696245 total=731220000
Time=1001 current=21462044 total=752682044
Time=1001 current=21591045 total=774273089
Time=1001 current=21778868 total=796051957
 
time em millisegundos, 1000 = 1s, 21778868 +/- = a 20mb, total 796051957 +/- = 780mb
 
Bem, no meu teste, foi capaz de escrever 21mb +/-, e conforme o arquivo foi crescendo, a quantia que escrevia por segundo aumentava :0...
Logo, o tamanho do arquivo não interfere muito pelo que vejo...
 
(não é nescessário abrir o arquivo para digitar nele...)
 
Fiz o mesmo teste em um hd SSD, e parece que o gargalo não é o HD
 
Time=1001 current=18644291 total=18644291
Time=1001 current=20543209 total=39187500
Time=1001 current=21192728 total=60380228
Time=1001 current=21074183 total=81454411
Time=1001 current=22010892 total=103465303
Time=1001 current=21437961 total=124903264
Time=1001 current=20996736 total=145900000
Time=1001 current=20040087 total=165940087
Time=1001 current=21633034 total=187573121
Time=1001 current=21217095 total=208790216
Time=1001 current=21636744 total=230426960
Time=1001 current=21689540 total=252116500
Time=1001 current=22305018 total=274421518
Time=1001 current=22187982 total=296609500
Time=1001 current=22336420 total=318945920
Time=1001 current=21921976 total=340867896
Time=1001 current=22576554 total=363444450
Time=1001 current=22023050 total=385467500
Time=1001 current=22206060 total=407673560
Time=1001 current=22151440 total=429825000
Time=1001 current=22531113 total=452356113
Time=1001 current=22110067 total=474466180
Time=1001 current=22320676 total=496786856
Time=1001 current=22145144 total=518932000
Time=1001 current=21988500 total=540920500
Time=1001 current=21906285 total=562826785
Time=1001 current=22191297 total=585018082
Time=1001 current=22049327 total=607067409
Time=1001 current=22471591 total=629539000
Time=1001 current=21549226 total=651088226
Time=1001 current=22140938 total=673229164
Time=1001 current=22078232 total=695307396
Time=1001 current=21434121 total=716741517
Time=1001 current=21427185 total=738168702
Time=1001 current=21785356 total=759954058
Time=1001 current=21617113 total=781571171

 

 

 

 

Código que usei, talvez eu esteja falando besteira, não sei nada sobre isso, só fiz testes '-'

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class WriteTest {

    public static void main(String[] args) throws IOException {
        File file = new File("C:/Users/willi/AppData/Roaming/test.txt");

        FileWriter writer = new FileWriter(file);

        long time = System.currentTimeMillis();
        int total = 0;
        int current = 0;
        List<Status> statusList = new ArrayList<>();

        while (total < 800000000) {

            current++;
            total++;

            writer.write((char) 0);

            if (total % 500 == 0) writer.flush();

            long elapsed = System.currentTimeMillis() - time;
            if (elapsed > 1000) {
                Status status = new Status();
                status.setCharsQuantity(total);
                status.setMilliSeconds(elapsed);
                status.setCurrent(current);

                time = System.currentTimeMillis();
                current = 0;

                statusList.add(status);
            }
        }


        writer.close();

        for (Status status : statusList) {
            System.out.println("Time=" + status.getMilliSeconds() + " current=" + status.getCurrent() + " total=" + status.getCharsQuantity());
        }
    }

    static class Status {
        private long charsQuantity;
        private long milliSeconds;
        private int current;

        public int getCurrent() {
            return current;
        }

        public void setCurrent(int current) {
            this.current = current;
        }

        public long getCharsQuantity() {
            return charsQuantity;
        }

        public void setCharsQuantity(long charsQuantity) {
            this.charsQuantity = charsQuantity;
        }

        public long getMilliSeconds() {
            return milliSeconds;
        }

        public void setMilliSeconds(long milliSeconds) {
            this.milliSeconds = milliSeconds;
        }
    }
}
 

 

 

Editado por Manolo8
Link para o comentário
Compartilhar em outros sites

 

Time=1001 current=17039499 total=17039499
Time=1001 current=20410464 total=37449963
Time=1001 current=20154180 total=57604143
Time=1001 current=22312357 total=79916500
Time=1001 current=21992000 total=101908500
Time=1001 current=21510460 total=123418960
Time=1001 current=22155314 total=145574274
Time=1001 current=22194777 total=167769051
Time=1001 current=22090400 total=189859451
Time=1001 current=21786771 total=211646222
Time=1001 current=21067038 total=232713260
Time=1001 current=19926183 total=252639443
Time=1001 current=22345447 total=274984890
Time=1001 current=20426906 total=295411796
Time=1001 current=19978704 total=315390500
Time=1001 current=20383500 total=335774000
Time=1001 current=19780496 total=355554496
Time=1001 current=20180077 total=375734573
Time=1001 current=20222427 total=395957000
Time=1001 current=22576791 total=418533791
Time=1001 current=21117571 total=439651362
Time=1001 current=19855160 total=459506522
Time=1001 current=19777284 total=479283806
Time=1001 current=20213508 total=499497314
Time=1001 current=20044574 total=519541888
Time=1001 current=20536112 total=540078000
Time=1001 current=20309330 total=560387330
Time=1001 current=20321924 total=580709254
Time=1001 current=20213712 total=600922966
Time=1001 current=22047034 total=622970000
Time=1001 current=20966970 total=643936970
Time=1001 current=21753551 total=665690521
Time=1001 current=21901321 total=687591842
Time=1001 current=21931913 total=709523755
Time=1001 current=21696245 total=731220000
Time=1001 current=21462044 total=752682044
Time=1001 current=21591045 total=774273089
Time=1001 current=21778868 total=796051957
 
time em millisegundos, 1000 = 1s, 21778868 +/- = a 20mb, total 796051957 +/- = 780mb
 
Bem, no meu teste, foi capaz de escrever 21mb +/-, e conforme o arquivo foi crescendo, a quantia que escrevia por segundo aumentava :0...
Logo, o tamanho do arquivo não interfere muito pelo que vejo...
 
(não é nescessário abrir o arquivo para digitar nele...)
 
Fiz o mesmo teste em um hd SSD, e parece que o gargalo não é o HD
 
Time=1001 current=18644291 total=18644291
Time=1001 current=20543209 total=39187500
Time=1001 current=21192728 total=60380228
Time=1001 current=21074183 total=81454411
Time=1001 current=22010892 total=103465303
Time=1001 current=21437961 total=124903264
Time=1001 current=20996736 total=145900000
Time=1001 current=20040087 total=165940087
Time=1001 current=21633034 total=187573121
Time=1001 current=21217095 total=208790216
Time=1001 current=21636744 total=230426960
Time=1001 current=21689540 total=252116500
Time=1001 current=22305018 total=274421518
Time=1001 current=22187982 total=296609500
Time=1001 current=22336420 total=318945920
Time=1001 current=21921976 total=340867896
Time=1001 current=22576554 total=363444450
Time=1001 current=22023050 total=385467500
Time=1001 current=22206060 total=407673560
Time=1001 current=22151440 total=429825000
Time=1001 current=22531113 total=452356113
Time=1001 current=22110067 total=474466180
Time=1001 current=22320676 total=496786856
Time=1001 current=22145144 total=518932000
Time=1001 current=21988500 total=540920500
Time=1001 current=21906285 total=562826785
Time=1001 current=22191297 total=585018082
Time=1001 current=22049327 total=607067409
Time=1001 current=22471591 total=629539000
Time=1001 current=21549226 total=651088226
Time=1001 current=22140938 total=673229164
Time=1001 current=22078232 total=695307396
Time=1001 current=21434121 total=716741517
Time=1001 current=21427185 total=738168702
Time=1001 current=21785356 total=759954058
Time=1001 current=21617113 total=781571171

 

 

 

 

Código que usei, talvez eu esteja falando besteira, não sei nada sobre isso, só fiz testes '-'

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class WriteTest {

    public static void main(String[] args) throws IOException {
        File file = new File("C:/Users/willi/AppData/Roaming/test.txt");

        FileWriter writer = new FileWriter(file);

        long time = System.currentTimeMillis();
        int total = 0;
        int current = 0;
        List<Status> statusList = new ArrayList<>();

        while (total < 800000000) {

            current++;
            total++;

            writer.write((char) 0);

            if (total % 500 == 0) writer.flush();

            long elapsed = System.currentTimeMillis() - time;
            if (elapsed > 1000) {
                Status status = new Status();
                status.setCharsQuantity(total);
                status.setMilliSeconds(elapsed);
                status.setCurrent(current);

                time = System.currentTimeMillis();
                current = 0;

                statusList.add(status);
            }
        }


        writer.close();

        for (Status status : statusList) {
            System.out.println("Time=" + status.getMilliSeconds() + " current=" + status.getCurrent() + " total=" + status.getCharsQuantity());
        }
    }

    static class Status {
        private long charsQuantity;
        private long milliSeconds;
        private int current;

        public int getCurrent() {
            return current;
        }

        public void setCurrent(int current) {
            this.current = current;
        }

        public long getCharsQuantity() {
            return charsQuantity;
        }

        public void setCharsQuantity(long charsQuantity) {
            this.charsQuantity = charsQuantity;
        }

        public long getMilliSeconds() {
            return milliSeconds;
        }

        public void setMilliSeconds(long milliSeconds) {
            this.milliSeconds = milliSeconds;
        }
    }
}
 

 

 

 

 

interessante isso ai, vlw :) agora posso usar log sem ter que preocupar em lagar o servidor dos meus clientes

Link para o comentário
Compartilhar em outros sites

Mas o problema é o espaço em disco que usa...

 

As vezes o servidor tem limite de 20gb e arquivos de logs imensos são problemáticos...

 

O que aconselho a fazer é, um sistema para zipar o arquivo de log sempre que o servidor é iniciado/ou diário, assim os 200mb serão míseros 5mb

Link para o comentário
Compartilhar em outros sites

Mas o problema é o espaço em disco que usa...

 

As vezes o servidor tem limite de 20gb e arquivos de logs imensos são problemáticos...

 

O que aconselho a fazer é, um sistema para zipar o arquivo de log sempre que o servidor é iniciado/ou diário, assim os 200mb serão míseros 5mb

hm, entendi blz, vlw man :) vou pesquisar como faz isso ai de zipar o arquivo com a host

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...