Git Product home page Git Product logo

esp32-psramfs's Issues

PsRamFS as LittleFS cache to accelerate a web server - viable?

Hi,

this looks like a very interesting project.

I have a performance issue with a web server using ESPAsyncWebServer serving from a small LittleFS root (maybe 1MB) - which is so slow that reading large files triggers the watchdog no matter how long I set it

so I was thinking about caching the LittleFS content in a PSRAM-based filesystem

Do you think this project is a viable base for such an effort?

what I would do is:

  • after boot, recursively copy the LittleFS contents to the PsRamFS (probably in a background task)
  • when serving a file, first check if the file is available in PsRamFS, and only fall back to LittleFS

another option would be to cook up something like a PSRAM-based LittleFS subclass which would just suck up the whole partition into PSRAM and serve from there, but I have no grasp how complex this would pan out.

Does this sound reasonable? which option would you choose?

I would be grateful for a frank opinion.

best regards
Michael

Handle FS using VFS POSIX API

Is POSIX style VFS API supported? I want to use this library in conjunction with SQLite 3 database for ESP32, all running in PSRAM (allocations for SQLite and the database files itself).

By the way, awesome project 😎

readBytes problem

Hello thanks for ESP32-PsRamFS ramdisk program.
Im using this useful program.
When I used readBytes(char *,sizs_t) function ,l could not read last char of this file.
followin is test program

#include "./PSRamFS.h"
#include "./pfs.h"
void setup() {
  Serial.begin(115200);
  esp32Info();
  if (!PSRamFS.begin()) {
    log_e("PSRamFS Mount Failed");
    return;
  }
  if (PSRamFS.exists("/test.txt")) {
    PSRamFS.remove("/test.txt");;
  }
  File t = PSRamFS.open("/test.txt", FILE_WRITE);
  if (t) {
    t.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    Serial.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    Serial.printf("\n/test.txt size= %d \n", t.size());
    t.close();
  }
  File r = PSRamFS.open("/test.txt", FILE_READ);
  int rsize = r.size();
  if (r) {
    int c = 0;
    char rbuf[32];
    int len = 0;
    int total = 0;
    do {
      len = r.readBytes(rbuf, sizeof(rbuf));
      for (int i = 0; i < len; i++) {
        Serial.print(rbuf[i]);
      }
      Serial.printf("\nlen=%d", len);
      total += len;
    } while (len);
    t.close();
    Serial.printf("\ntotal=%d", total);
    if (total != rsize) {
      Serial.printf("\nwe can read all data except file end..Z");
    }
  }
  Serial.println("\nEND");
}

void loop() {
  // put your main code here, to run repeatedly:

}
void esp32Info(void) {
  Serial.println("---------------------------- -");
  uint64_t chipid;
  chipid = ESP.getEfuseMac(); //The chip ID is essentially its MAC address(length: 6 bytes).
  Serial.printf("ESP32 Chip ID = % 04X\r\n", (uint16_t)(chipid >> 32)); //print High 2 bytes
  Serial.printf("Chip Revision % d\r\n", ESP.getChipRevision());
  esp_chip_info_t chip_info;
  esp_chip_info(&chip_info);
  Serial.printf("Number of Core: % d\r\n", chip_info.cores);
  Serial.printf("CPU Frequency: % d MHz\r\n", ESP.getCpuFreqMHz());
  Serial.printf("Flash Chip Size = % d byte\r\n", ESP.getFlashChipSize());
  Serial.printf("Flash Frequency = % d Hz\r\n", ESP.getFlashChipSpeed());
  Serial.printf("Free Heap Size = % d\r\n", esp_get_free_heap_size());
  Serial.printf("Total PSRAM: %d\r\n", ESP.getPsramSize());
  Serial.printf("Free PSRAM: %d\r\n", ESP.getFreePsram());
  Serial.printf("ESP - IDF version = % s\r\n", esp_get_idf_version());
  Serial.println();
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.